未验证 提交 a43d8e59 编写于 作者: C chentianyu03 提交者: GitHub

add grad maker debug log (#38183)

上级 023ff4f5
...@@ -236,6 +236,7 @@ class TracedGradOp { ...@@ -236,6 +236,7 @@ class TracedGradOp {
if (kRole == TracedVarRole::kBackward) { if (kRole == TracedVarRole::kBackward) {
for (auto& var : vars) { for (auto& var : vars) {
VLOG(6) << "SetIutput var name: " << var->Name();
if (var && !var->OverridedStopGradient()) { if (var && !var->OverridedStopGradient()) {
var->SetGraphIsFreed(false); var->SetGraphIsFreed(false);
auto dirty_grad_node = var->GradNode(); auto dirty_grad_node = var->GradNode();
...@@ -267,17 +268,22 @@ class TracedGradOp { ...@@ -267,17 +268,22 @@ class TracedGradOp {
return; return;
} else { } else {
for (auto& var : vars) { for (auto& var : vars) {
VLOG(6) << "SetOutput var name: " << var->Name();
if (var && !var->OverridedStopGradient() && var->GradNode()) { if (var && !var->OverridedStopGradient() && var->GradNode()) {
if (map_dirty_grad_node_.find(var) != map_dirty_grad_node_.end()) { if (map_dirty_grad_node_.find(var) != map_dirty_grad_node_.end()) {
// Because inplace var isn't a leaf var, it should have // Because inplace var isn't a leaf var, it should have
// dirty_grad_node. // dirty_grad_node.
node_->InsertGradPendingNode(map_dirty_grad_node_[var]); node_->InsertGradPendingNode(map_dirty_grad_node_[var]);
VLOG(6) << (*node_.get())[0].Type() << " insertGradPendingNode "
<< (*(map_dirty_grad_node_[var].get()))[0].Type();
} else if (node_ != var->GradNode()) { } else if (node_ != var->GradNode()) {
// For non-inplace var. // For non-inplace var.
// Special case: `set_value` is inplace op, and it can change // Special case: `set_value` is inplace op, and it can change
// the var with `stop_gradient=True` to the var with // the var with `stop_gradient=True` to the var with
// `stop_gradient=False`. // `stop_gradient=False`.
node_->InsertGradPendingNode(var->GradNode()); node_->InsertGradPendingNode(var->GradNode());
VLOG(6) << (*node_.get())[0].Type() << " insertGradPendingNode "
<< (*(var->GradNode().get()))[0].Type();
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册