TaoLv commented on a change in pull request #13260: Support full convention in 
quantized pooling
URL: https://github.com/apache/incubator-mxnet/pull/13260#discussion_r234842851
 
 

 ##########
 File path: src/operator/quantization/quantized_pooling.cc
 ##########
 @@ -52,17 +52,30 @@ bool QuantizedPoolingShape(const nnvm::NodeAttrs& attrs,
       << "kernel size (" << param.kernel[1]
       << ") exceeds input (" << dshape[W]
       << " padded to " << (dshape[W] + 2*param.pad[1]) << ")";
-  // only support valid convention
+
   oshape[N] = dshape[N];
   oshape[C] = dshape[C];
   if (param.global_pool) {
     oshape[H] = 1;
     oshape[W] = 1;
   } else {
-    oshape[H] = 1 + (dshape[H] + 2 * param.pad[0] - param.kernel[0]) /
-        param.stride[0];
-    oshape[W] = 1 + (dshape[W] + 2 * param.pad[1] - param.kernel[1]) /
-        param.stride[1];
+     if (param.pooling_convention == pool_enum::kValid) {
+      oshape[2] = 1 +
+                  (dshape[2] + 2 * param.pad[0] - param.kernel[0]) /
+                      param.stride[0];
+      oshape[3] = 1 +
+                  (dshape[3] + 2 * param.pad[1] - param.kernel[1]) /
+                      param.stride[1];
+    } else {
+      oshape[2] = 1 + static_cast<int>(std::ceil(
 
 Review comment:
   You are probably right. But this code snippet was copied from FP32 pooling 
infer shape here: 
https://github.com/apache/incubator-mxnet/blob/master/src/operator/nn/pooling.cc#L163
   
   I try not to change the code of FP32 pooling in this PR and keep the code 
align between quantized pooling and FP32 pooling. So I would keep it as is and 
refactor them in another PR in the future. What do you think?

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

Reply via email to