diff --git a/mindspore/ccsrc/pynative/pynative_execute.cc b/mindspore/ccsrc/pynative/pynative_execute.cc index d65807b9f6..b5f0958a1a 100644 --- a/mindspore/ccsrc/pynative/pynative_execute.cc +++ b/mindspore/ccsrc/pynative/pynative_execute.cc @@ -261,8 +261,10 @@ py::object RunOpInVM(const OpExecInfoPtr &op_exec_info, PynativeStatusCode *stat if (py::hasattr(input, "__parameter__")) { result[i] = py::getattr(input, "data"); } else { - auto tensor = py::cast(op_inputs[i]); + auto tensor = py::cast(input); auto new_tensor = std::make_shared(tensor->data()); + new_tensor->set_device_address(tensor->device_address()); + new_tensor->set_dirty(tensor->is_dirty()); result[i] = new_tensor; } }