mbrookhart commented on a change in pull request #12502: [NGRAPH] MXNet -
nGraph initial integration
URL: https://github.com/apache/incubator-mxnet/pull/12502#discussion_r220786662
##########
File path: src/operator/subgraph/partition_graph.cc
##########
@@ -238,21 +239,21 @@ bool LabelSubgraph(const Graph& g,
const std::vector<nnvm::Node*>& snodes) {
if (ancestor == descendant) return true;
std::stack<const nnvm::Node*> s;
+ std::unordered_set<const nnvm::Node*> visited;
s.push(descendant);
size_t count = 0;
while (!s.empty()) {
- CHECK_LT(count, indexed_graph.num_nodes()) << "Finding ancestor failed.
There is probably"
- " a loop in the graph";
+ CHECK_LT(count, indexed_graph.num_nodes())
+ << "Finding ancestor failed. There is probably a loop in the graph";
++count;
const nnvm::Node* top = s.top();
s.pop();
+ visited.insert(top);
if (top == ancestor) {
return true;
}
for (const auto& entry : top->inputs) {
- // when searching for the ancestor, the path cannot cross any subgraph
node
- auto it = std::find(snodes.begin(), snodes.end(), entry.node.get());
Review comment:
There was originally a bug in the Subgraph API, the change here (with the
initialization of visited on line 242 of the new file) fixes that bug as agreed
via email with @reminisce.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services