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_r189499998
##########
File path: src/operator/quantization/quantize_graph_pass.cc
##########
@@ -198,12 +199,11 @@ 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();
- uint32_t min_index = num_outputs + 2 * e.index;
- uint32_t max_index = num_outputs + 2 * e.index + 1;
-
// if input node is quantized operator, add dequantize node
if (NeedQuantize(e.node, excluded_nodes)) {
+ size_t num_outputs = mirror_node->num_outputs() - 2;
+ uint32_t min_index = num_outputs + 2 * e.index;
+ uint32_t max_index = num_outputs + 2 * e.index + 1;
Review comment:
The num_outputs/min_index/max_index calculation logic is used for "If
(NeedQuantize(e.node, excluded_nodes))" branch so I moved the logic under If
branch to simplify logic, the num_outputs calculation logic change is the same
reason as above comment.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services