未验证 提交 2a7efefe 编写于 作者: Z Zhen Wang 提交者: GitHub

Add some error messages for the op without double grads. (#25951) (#25963)

* Add some error messages for the op without double grads.

* fix the test_imperative_double_grad UT.
上级 c55f2219
......@@ -870,13 +870,15 @@ void PartialGradTask::RunEachOp(OpBase *op) {
if (create_graph_) {
auto double_grad_node = CreateGradOpNode(op->InnerOp(), tmp_ins, tmp_outs,
op->Attrs(), op->place());
if (double_grad_node) {
PADDLE_ENFORCE_NOT_NULL(
double_grad_node,
platform::errors::NotFound("The Op %s doesn't have any grad op.",
op->Type()));
VLOG(10) << "Create " << double_grad_node->size()
<< " double grad op(s) for " << op->Type()
<< ", pending ops: " << GradPendingOpTypes(*double_grad_node);
double_grad_nodes_.emplace_back(std::move(double_grad_node));
}
}
VLOG(10) << "There are " << grads_to_accumulate_.size() << " to sum gradient";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册