Filter out the node not seen in the stack.

pull/10248/head
Zhang Qinghua 5 years ago
parent b8b57f8fc3
commit b45c38ffaa

@ -77,12 +77,12 @@ std::vector<AnfNodePtr> TopoSort(const AnfNodePtr &root, const SuccFunc &succ, c
auto circle_node_it = std::find(todo.begin(), todo.end(), next); auto circle_node_it = std::find(todo.begin(), todo.end(), next);
for (; circle_node_it != todo.end(); circle_node_it++) { for (; circle_node_it != todo.end(); circle_node_it++) {
auto circle_node = *circle_node_it; auto circle_node = *circle_node_it;
if (circle_node->seen_) { if (circle_node->seen_ == seen) {
MS_LOG(ERROR) << "#" << pos << ": " << circle_node->DebugString(); MS_LOG(ERROR) << "#" << pos << ": " << circle_node->DebugString();
pos++; pos++;
} }
} }
MS_LOG(EXCEPTION) << "Graph cycle exists, node " << next->DebugString(2); MS_LOG(EXCEPTION) << "Graph cycle exists, strike node: " << next->DebugString(2);
}); });
} else if (incl > EXCLUDE) { // Not NOFOLLOW or EXCLUDE } else if (incl > EXCLUDE) { // Not NOFOLLOW or EXCLUDE
MS_LOG(EXCEPTION) << "The result of include(node) must be one of: \"follow\", \"nofollow\", \"exclude\""; MS_LOG(EXCEPTION) << "The result of include(node) must be one of: \"follow\", \"nofollow\", \"exclude\"";

Loading…
Cancel
Save