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_r220405988
 
 

 ##########
 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:
   OK. But this is not a good design that we didn't have a rule that which 
index should be the subgraph symbol node as I comment in your subgraph PR. We 
have to assume that the first node(index 0) is the subgraph node, and all 
developers won't break this.

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

Reply via email to