reminisce commented on a change in pull request #14113: Enhance subgraph API URL: https://github.com/apache/incubator-mxnet/pull/14113#discussion_r269839030
########## File path: src/operator/subgraph/build_subgraph.cc ########## @@ -748,27 +693,38 @@ Graph PartitionGraph(Graph&& g) { std::unordered_map<const nnvm::NodeEntry*, size_t> entry_top_order_map; TopSortEntries(g, &entry_top_order_map); - // Create undirected graph for ease of finding subgraphs - std::vector<SimpleNodePtr> simple_nodes; + // Create double directional graph for ease of finding subgraphs + std::vector<BiDirectionalNodePtr> simple_nodes; CreateSimpleGraph(g, &simple_nodes); - std::vector<std::vector<SimpleNode*>> subgraph_nodes; - FindSubgraphs(&g, *subg_prop, simple_nodes, &subgraph_nodes); + std::vector<std::vector<BiDirectionalNode*>> subgraph_nodes; + std::vector<SubgraphSelectorV2Ptr> subgraph_selectors; + FindSubgraphs(&g, *subg_prop, simple_nodes, &subgraph_nodes, &subgraph_selectors); + CHECK_EQ(subgraph_nodes.size(), subgraph_selectors.size()); for (size_t i = 0; i < subgraph_nodes.size(); ++i) { #if DEBUG_SUBGRAPH - std::set<SimpleNode*> simple_node_set(subgraph_nodes[i].begin(), subgraph_nodes[i].end()); + std::set<BiDirectionalNode*> simple_node_set(subgraph_nodes[i].begin(), + subgraph_nodes[i].end()); CHECK_EQ(simple_node_set.size(), subgraph_nodes[i].size()); PrintSubgraph(subgraph_nodes[i]); #endif - CreateSubgraphNode(&g, simple_nodes, subgraph_nodes[i], i, &entry_top_order_map); - } + auto ptype = subg_prop->GetPropertyType(); + if (ptype == SubgraphProperty::SgPropertyType::kCreate) { + CreateSubgraphNode(&g, simple_nodes, subgraph_nodes[i], subgraph_selectors[i], i, + &entry_top_order_map); + } else { + CHECK_EQ(ptype, SubgraphProperty::SgPropertyType::kAdjust); + AdjustSubgraphNode(&g, subgraph_nodes[i], subgraph_selectors[i], i); + } Review comment: Indentation seems wrong. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services