From 8856c2595bb53a5480c49ba31b442e3ec7d7d2e3 Mon Sep 17 00:00:00 2001 From: Wei-Sheng Chin Date: Mon, 2 Nov 2020 23:22:47 -0800 Subject: [PATCH] Sync the two IDs in OrtMemoryInfo when calling ctor (#5663) * Sync the two IDs in OrtMemoryInfo when calling ctor * Also fix the same problem for output --- onnxruntime/python/onnxruntime_pybind_state.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime/python/onnxruntime_pybind_state.cc b/onnxruntime/python/onnxruntime_pybind_state.cc index 8ae57efd31..6bc48dafba 100644 --- a/onnxruntime/python/onnxruntime_pybind_state.cc +++ b/onnxruntime/python/onnxruntime_pybind_state.cc @@ -1289,7 +1289,7 @@ void addObjectMethods(py::module& m, Environment& env) { int type_num = dtype->type_num; Py_DECREF(dtype); - OrtMemoryInfo info(GetDeviceName(device), OrtDeviceAllocator, device); + OrtMemoryInfo info(GetDeviceName(device), OrtDeviceAllocator, device, device.Id()); std::unique_ptr p_tensor = onnxruntime::make_unique(NumpyTypeToOnnxRuntimeType(type_num), shape, reinterpret_cast(data_ptr), info); @@ -1338,7 +1338,7 @@ void addObjectMethods(py::module& m, Environment& env) { int type_num = dtype->type_num; Py_DECREF(dtype); - OrtMemoryInfo info(GetDeviceName(device), OrtDeviceAllocator, device); + OrtMemoryInfo info(GetDeviceName(device), OrtDeviceAllocator, device, device.Id()); std::unique_ptr p_tensor = onnxruntime::make_unique(NumpyTypeToOnnxRuntimeType(type_num), shape, reinterpret_cast(data_ptr), info);