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

add enforce check for set_value (#32972)

上级 d7d7fae1
......@@ -766,6 +766,13 @@ void BindImperative(py::module *m_ptr) {
imperative::NameVarBaseMap ins = {{"Input", {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 =
value_obj.cast<std::shared_ptr<imperative::VarBase>>();
ins.insert({"ValueTensor", {value_tensor}});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册