From e123b873719fb724f8dd7cbfff7559c4ed4186ac Mon Sep 17 00:00:00 2001 From: Jiabin Yang Date: Sun, 26 Sep 2021 11:31:58 +0800 Subject: [PATCH] fix dygraph grad to support high differential (#36059) --- paddle/fluid/imperative/partial_grad_engine.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/imperative/partial_grad_engine.cc b/paddle/fluid/imperative/partial_grad_engine.cc index 84ba60fef8..c1ec675a55 100644 --- a/paddle/fluid/imperative/partial_grad_engine.cc +++ b/paddle/fluid/imperative/partial_grad_engine.cc @@ -137,10 +137,12 @@ static void GetGraphInfoBetweenTargets( } for (auto &pending_node : node->GradPendingNodes()) { + for (auto &pending_op : *pending_node) { + preceding_ops[&pending_op].insert(op); + } if (visited.count(pending_node.get()) == 0) { visited.insert(pending_node.get()); for (auto &pending_op : *pending_node) { - preceding_ops[&pending_op].insert(op); q.emplace(&pending_op, pending_node.get()); } } -- GitLab