jinhuang415 commented on a change in pull request #10433: [MXNET-290] MKLDNN 
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r183753288
 
 

 ##########
 File path: src/operator/quantization/quantize_graph_pass.cc
 ##########
 @@ -198,7 +198,7 @@ Graph QuantizeGraph(Graph &&src) {
         NodePtr mirror_node = mirror_map.at(e.node.get());
         NodeEntry mirror_entry = NodeEntry{
           mirror_node, e.index, e.version};
-        size_t num_outputs = e.node->num_outputs();
+        size_t num_outputs = mirror_node->num_outputs() - 2;
 
 Review comment:
   I checked the logic, the reason for this change is the output number (if 
exclude min/max) of a OP maybe different for FP32 version and INT8 version for 
CPU, like pooling, for FP32 there may have 2 outputs (one for data one for 
workspace), but for INT8 version there is only 1 output (data). So here we need 
to get the quantized OP output number instead of original FP32 OP's. 
mirror_node is the quantized OP in this case and need to subtract 2 (for 
min/max) to get min/max's start index. I will add comment here to ease 
understanding.

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