forked from mindspore-Ecosystem/mindspore
fix-grad-value-is-wrong-in-pynative-hook
This commit is contained in:
parent
16a75779be
commit
24c0a8256f
|
@ -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<tensor::TensorPtr>(op_inputs[i]);
|
||||
auto tensor = py::cast<tensor::TensorPtr>(input);
|
||||
auto new_tensor = std::make_shared<tensor::Tensor>(tensor->data());
|
||||
new_tensor->set_device_address(tensor->device_address());
|
||||
new_tensor->set_dirty(tensor->is_dirty());
|
||||
result[i] = new_tensor;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue