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_r220409445
 
 

 ##########
 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:
   Also, I don't know which kind of CHECK can be added here. 
CHECK(node->attrs.subgraphs.size() == 1)? Why can't we support more than 1 
subgraph symbol? All we need to check here is the demanded symbol should be in 
index 0, but this is not checkable.

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