Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Remove check for subgraph with cycles
Browse files Browse the repository at this point in the history
Signed-off-by: Serge Panev <[email protected]>
  • Loading branch information
Kh4L committed Jun 15, 2020
1 parent 1bf881f commit 5289d05
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/operator/subgraph/build_subgraph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,7 @@ bool LabelSubgraph(const nnvm::Graph& g, SubgraphSelectorV2Ptr subgraph_selector
std::stack<const nnvm::Node*> s;
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";
while (!s.empty() && count < indexed_graph.num_nodes()) {
++count;
const nnvm::Node* top = s.top();
s.pop();
Expand Down Expand Up @@ -276,10 +274,6 @@ bool LabelSubgraph(const nnvm::Graph& g, SubgraphSelectorV2Ptr subgraph_selector

if (excluded_node_id != -1) {
CHECK_LT(excluded_node_id, static_cast<int>(simple_nodes.size()));
CHECK_NE(excluded_node_id, static_cast<int>(snid))
<< "A cycle is found in the computational graph between nodes "
<< simple_nodes[excluded_node_id]->node->attrs.name << " and "
<< simple_nodes[snid]->node->attrs.name;
excluded_nodes->insert(simple_nodes[excluded_node_id].get());
ResetNodeLabels(g, simple_nodes, subgraph_nodes);
return false;
Expand Down

0 comments on commit 5289d05

Please sign in to comment.