We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 04db220 commit 54629caCopy full SHA for 54629ca
1 file changed
paddle/fluid/pybind/eager_py_layer.cc
@@ -119,6 +119,9 @@ PyObject* new_tensor_with_impl(paddle::Tensor* tensor) {
119
new (&(v->tensor)) paddle::Tensor();
120
v->tensor.set_impl(tensor->impl());
121
v->tensor.set_name(egr::Controller::Instance().GenerateUniqueName());
122
+ egr::EagerUtils::autograd_meta(&v->tensor)
123
+ ->SetStopGradient(
124
+ egr::EagerUtils::autograd_meta(tensor)->StopGradient());
125
} else {
126
PADDLE_THROW(platform::errors::Fatal(
127
"tp_alloc return null, can not new a PyObject."));
0 commit comments