提交 3556514e 编写于 作者: Z zhongpu 提交者: Jiabin Yang

add PADDLE_ENFORCE for dygraph to optimize error throw (#19783)

* add PADDLE_ENFORCE for dygraph to optimize error throw, test=develop

* fix some error, test=develop

* delete PADDLE_ENFORCE_EQ in VarBase::NewVarBase, test=develop
上级 7f17da4c
......@@ -230,10 +230,12 @@ void Tracer::TraceBackward(const std::shared_ptr<OpBase>& fwd_op,
VLOG(3) << op->Type();
}
}
auto grad_name = (*(fwd_var_iter->second))->GradVarBase()->Name();
if (!grad_pending_ops.empty()) {
for (const auto& op : grad_pending_ops) {
PADDLE_ENFORCE_NOT_NULL(op,
"No nullptr should be grad_pending op");
PADDLE_ENFORCE_NOT_NULL(
op, "No nullptr should be grad_pending op for variable %s ",
grad_name);
if (visited_preceding_ops.count(op) == 0) {
visited_preceding_ops.insert(op);
grad_op->InsertGradPendingOps(op);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册