Browse Source

fix-grad-value-is-wrong-in-pynative-hook

tags/v0.6.0-beta
lvliang 5 years ago
parent
commit
43463e1028
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      mindspore/ccsrc/pynative/pynative_execute.cc

+ 3
- 1
mindspore/ccsrc/pynative/pynative_execute.cc View File

@@ -302,8 +302,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_type(), tensor->shape(), tensor->data_ptr());
new_tensor->set_device_address(tensor->device_address());
new_tensor->set_dirty(tensor->is_dirty());
result[i] = new_tensor;
}
}


Loading…
Cancel
Save