ZhennanQin commented on a change in pull request #14275: Register fake grad to subgraph and quantized operators URL: https://github.com/apache/incubator-mxnet/pull/14275#discussion_r262327677
########## File path: src/executor/graph_executor.cc ########## @@ -1506,8 +1506,26 @@ static nnvm::Symbol PartitionGraph(const nnvm::Symbol& src, const Context& default_ctx, const std::map<std::string, Context>& ctx_map, const std::vector<Context>& in_arg_ctxes, - const std::vector<Context>& aux_state_ctxes) { + const std::vector<Context>& aux_state_ctxes, + const std::vector<OpReqType>& grad_req_types) { auto subgraph_prop = op::SubgraphPropertyRegistry::Get()->CreateSubgraphProperty(prop_name); + bool need_grad = false; + for (OpReqType req : grad_req_types) { + if (req != kNullOp) { + need_grad = true; + break; + } + } + if (subgraph_prop->HasAttr("inference_only") && + subgraph_prop->GetAttr<bool>("inference_only") == true) { + if (need_grad) { + auto full_name = subgraph_prop->HasAttr("prop_name") + ? subgraph_prop->GetAttr<std::string>("prop_name") + : prop_name; + LOG(INFO) << "Skip subgraph " << full_name << " as it requires `grad_req=null`."; + return src; + } + } Review comment: The problem is, we can't get the symbol after module bound. So we can't check if MKLDNN graph partitioning happens or not. ---------------------------------------------------------------- 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