CoinCheung commented on a change in pull request #10000: [MXNET-80] Fix average 
pooling kernel size assignment error
URL: https://github.com/apache/incubator-mxnet/pull/10000#discussion_r174356271
 
 

 ##########
 File path: src/operator/nn/pooling.cc
 ##########
 @@ -98,9 +103,24 @@ static bool PoolingShape(const nnvm::NodeAttrs &attrs,
       << "Pooling: Input data should be  3D in (batch, channel, x)"
       << " Or 4D in (batch, channel, y, x) "
       << " Or 5D in (batch, channel, d, y, x)";
+  CHECK_LE(dshape.ndim(), 5U)
+      << "Pooling: Input data should be  3D in (batch, channel, x)"
+      << " Or 4D in (batch, channel, y, x) "
+      << " Or 5D in (batch, channel, d, y, x)";
   TShape oshape = dshape;
   if (dshape.ndim() == 0) return false;
-  if (param.kernel.ndim() == 1) {
+  if (param.global_pool) {
+      if (dshape.ndim() == 3) {
+          oshape[2] = 1;
+      } else if (dshape.ndim() == 4) {
+          oshape[2] = 1;
+          oshape[3] = 1;
+      } else if (dshape.ndim() == 5) {
+          oshape[2] = 1;
+          oshape[3] = 1;
+          oshape[4] = 1;
+      }
 
 Review comment:
   There is another mismatch at this line:
   
https://github.com/apache/incubator-mxnet/blob/c9ec3118688c233a66ad847003a9e8d2d09e5952/src/operator/nn/pool.h#L690
   and I have no idea how I could fix this as this function pool() have no 
global_pool as input parameter. 

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