diff --git a/mindspore/ccsrc/vm/backend.cc b/mindspore/ccsrc/vm/backend.cc index 3fde263c9db3a7e90c7429110861f0893eb1983a..4341427a67a43d557a16696ffd704a6ba6a11058 100644 --- a/mindspore/ccsrc/vm/backend.cc +++ b/mindspore/ccsrc/vm/backend.cc @@ -353,7 +353,10 @@ void MsBackend::CreateOtherSession(const std::string &target) { if (other_sess_ == nullptr) { 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_device_ = target; }