fix mix target device id

pull/2752/head
kswang 5 years ago
parent 65189e8ccc
commit 04d01a36f4

@ -353,7 +353,10 @@ void MsBackend::CreateOtherSession(const std::string &target) {
if (other_sess_ == nullptr) { if (other_sess_ == nullptr) {
MS_LOG(EXCEPTION) << "Session create failed!, please make sure target device:" << target << " is available."; MS_LOG(EXCEPTION) << "Session create failed!, please make sure target device:" << target << " is available.";
} }
other_sess_->Init(0); auto context_ptr = MsContext::GetInstance();
MS_EXCEPTION_IF_NULL(context_ptr);
uint32_t device_id = context_ptr->device_id();
other_sess_->Init(device_id);
other_sess_->RegisterSummaryCallBackFunc(callbacks::SummarySaveCallback); other_sess_->RegisterSummaryCallBackFunc(callbacks::SummarySaveCallback);
other_device_ = target; other_device_ = target;
} }

Loading…
Cancel
Save