未验证 提交 b9c8c1b1 编写于 作者: W Weilong Wu 提交者: GitHub

[Eager] polish general_grad (#47151)

上级 7a2489e6
......@@ -165,9 +165,6 @@ class GeneralGrad {
void GetGraphInfoBetweenTargets(const std::deque<GradNodeBase*>& init_queue) {
VLOG(6) << "Runing In GetGraphInfoBetweenTargets";
// Calculate in_degree for each node
std::unordered_map<GradNodeBase*, int> node_in_degree_map;
// Copy nodes
std::deque<GradNodeBase*> queue = init_queue;
std::unordered_set<GradNodeBase*> visited;
......@@ -196,12 +193,6 @@ class GeneralGrad {
// Or it could also originated from dispensable inputs
if (!next_node) continue;
// Update in_degree
if (!node_in_degree_map.count(next_node)) {
node_in_degree_map[next_node] = 0;
}
node_in_degree_map[next_node]++;
// Record depending relationship
(depending_nodes_)[next_node].emplace(node);
queue.push_back(next_node);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册