未验证 提交 b4b9438a 编写于 作者: C Chen Weihang 提交者: GitHub

[Cherry-pick] add enforce check for set_value (#32972) (#32981)

cherry-pick of #32972
上级 ab1a4df9
...@@ -710,6 +710,13 @@ void BindImperative(py::module *m_ptr) { ...@@ -710,6 +710,13 @@ void BindImperative(py::module *m_ptr) {
imperative::NameVarBaseMap ins = {{"Input", {self}}}; imperative::NameVarBaseMap ins = {{"Input", {self}}};
imperative::NameVarBaseMap outs = {{"Out", {self}}}; imperative::NameVarBaseMap outs = {{"Out", {self}}};
PADDLE_ENFORCE_EQ(
self->IsLeaf() && !self->OverridedStopGradient(), false,
platform::errors::InvalidArgument(
"Leaf Tensor (%s) that doesn't stop gradient can't use "
"inplace strategy.",
self->Name()));
auto value_tensor = auto value_tensor =
value_obj.cast<std::shared_ptr<imperative::VarBase>>(); value_obj.cast<std::shared_ptr<imperative::VarBase>>();
ins.insert({"ValueTensor", {value_tensor}}); ins.insert({"ValueTensor", {value_tensor}});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册