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
This commit is contained in:
Wei-Sheng Chin 2020-11-02 23:22:47 -08:00 committed by GitHub
parent 4936e10e22
commit 8856c2595b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<Tensor> p_tensor =
onnxruntime::make_unique<Tensor>(NumpyTypeToOnnxRuntimeType(type_num), shape, reinterpret_cast<void*>(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<Tensor> p_tensor = onnxruntime::make_unique<Tensor>(NumpyTypeToOnnxRuntimeType(type_num), shape, reinterpret_cast<void*>(data_ptr), info);