diff --git a/mindspore/ccsrc/runtime/device/ascend/ascend_device_address.cc b/mindspore/ccsrc/runtime/device/ascend/ascend_device_address.cc index 7e7060658e..eac7ca90da 100644 --- a/mindspore/ccsrc/runtime/device/ascend/ascend_device_address.cc +++ b/mindspore/ccsrc/runtime/device/ascend/ascend_device_address.cc @@ -706,7 +706,7 @@ bool AscendDeviceAddress::LoadMemToHost(const std::string &tensor_name, int exec tensor_data->SetName(tensor_name); tensor_data->SetExecutionOrder(execution_order); tensor_data->SetSlot(slot); - mindspore::tensor::TensorPtr out_tensor = std::make_shared(type_id_, host_shape); + mindspore::tensor::TensorPtr out_tensor = std::make_shared(host_type, host_shape); size_t host_size = out_tensor->data().nbytes(); auto ret_rt_memcpy = rtMemcpy(out_tensor->data_c(), host_size, ptr_, host_size, RT_MEMCPY_DEVICE_TO_HOST); if (ret_rt_memcpy != RT_ERROR_NONE) { diff --git a/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc b/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc index 78e7c6cc65..362b0db978 100644 --- a/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc +++ b/mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc @@ -107,7 +107,7 @@ bool GPUDeviceAddress::LoadMemToHost(const std::string &tensor_name, int executi return true; } - mindspore::tensor::TensorPtr out_tensor = std::make_shared(type_id_, host_shape); + mindspore::tensor::TensorPtr out_tensor = std::make_shared(host_type, host_shape); size_t host_size = out_tensor->data().nbytes(); auto ret_rt_memcpy = SyncDeviceToHost(host_shape, host_size, host_type, out_tensor->data_c()); if (!ret_rt_memcpy) {