ZhennanQin commented on a change in pull request #12530: Implement mkldnn convolution fusion and quantization. URL: https://github.com/apache/incubator-mxnet/pull/12530#discussion_r221126691
########## File path: src/operator/quantization/quantize_graph_pass.cc ########## @@ -89,17 +89,41 @@ std::vector<NodeEntry> OfflineParams(std::vector<NodeEntry>&& outputs, return outputs; } -inline bool NeedQuantize(NodePtr node, const std::unordered_set<NodePtr> excluded_nodes) { +inline bool NeedQuantize(NodePtr node, const std::unordered_set<std::string>& excluded_nodes) { static auto& quantized_op_map = Op::GetAttr<mxnet::FQuantizedOp>("FQuantizedOp"); - return quantized_op_map.count(node->op()) && !excluded_nodes.count(node); + if (quantized_op_map.count(node->op())) { + bool excluded = false; + if (node->attrs.subgraphs.size()) { + // This is a subgraph node, try to match subgraph name first, + // and then try to match inner node. + if (excluded_nodes.count(node->attrs.name)) { + excluded = true; + } else { + auto subgraph_sym = node->attrs.subgraphs[0]; Review comment: @zheng-da If we don't need more than 1 subgraph in a node, why we define subgraphs as a vector? @reminisce If subgraph is produced and handled by each backend itself, then each backend can decide its subgraph sequence. But the thing is, we need to add code to common part to handle all subgraphs from various backends. This part change is an example. So it's better to have such a rule that all backends to follow, and then we can make check based on that. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services