TaoLv commented on issue #9730: Check padding size for global pooling
URL: https://github.com/apache/incubator-mxnet/pull/9730#issuecomment-494251934
 
 
   I would say these layers finally get the correct input now. :)
   
   For your case, if you want to get the same results as before, please try 
below changes:
   ```python
   import mxnet as mx
   
   class Batch(object):
       def __init__(self, data):
           self.data = data
   
       def get_batch_shape(self):
           return tuple(self.data[0].shape)
   
   data = mx.sym.Variable('data')
   gpool = mx.sym.Pooling(data,
                          name='gpooling',
                          global_pool=False,    # <--- remove global pooling
                          pad=(1,1), pool_type='avg',
                          stride=(5,5),         # <--- add stride
                          kernel=(5,5),)        # <--- change kernel size to 
input size
   mod = mx.mod.Module(gpool, context=mx.cpu(0), label_names=[])
   data = Batch([mx.ndarray.ones((1, 3, 5, 5))])
   mod.bind(for_training=True, force_rebind=True, data_shapes=[('data', 
data.get_batch_shape())],)
   mod.init_params()
   mod.forward(data)
   print(mx.__version__)
   print(mod.get_outputs()[0].asnumpy())
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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