waytrue17 commented on a change in pull request #18690:
URL: https://github.com/apache/incubator-mxnet/pull/18690#discussion_r460610246



##########
File path: src/operator/subgraph/build_subgraph.cc
##########
@@ -360,6 +405,17 @@ void SelectSubgraphNodes(nnvm::Graph* g, 
SubgraphSelectorV2Ptr subgraph_selector
     // filter out unqualified pre-selected nodes
     std::vector<BiDirectedNode*> filtered_nodes = 
subgraph_selector->Filter(preselected_nodes);
 
+    const SubgraphPropertyPtr& subg_prop = 
g->GetAttr<SubgraphPropertyPtr>("subgraph_property");
+    if (subg_prop->HasAttr("ensure_CachedOp_input")
+        && subg_prop->GetAttr<bool>("ensure_CachedOp_input")) {
+      // check if subgraph has external input.
+      // if not, reject the first op (in top order) from the subgraph
+      // to make sure CachedOp gets external input.
+      if (filtered_nodes.size() > 0 && !HasInputEntries(*g, simple_nodes, 
filtered_nodes)) {
+        filtered_nodes.erase(filtered_nodes.begin());

Review comment:
       Moved `ensure_CachedOp_input` inside `PreSelectSubgraphNodes`




----------------------------------------------------------------
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


Reply via email to