ThomasDelteil edited a comment on issue #14357: [Bug] Batchnorm running_var 
behaves differently when using gpu vs. cpu
URL: 
https://github.com/apache/incubator-mxnet/issues/14357#issuecomment-497487102
 
 
   ```python
   for ctx in [mx.cpu(), mx.gpu()]:
       layer = gluon.nn.BatchNorm()
       layer.initialize(ctx=ctx)
       for i in range(100):
           data = mx.nd.random.normal(loc=10, scale=2, shape=(1,3,224,224), 
ctx=ctx)
           with autograd.record():
               out = layer(data)
       print(ctx, layer.running_var.data().asnumpy(), 
layer.running_mean.data().asnumpy())
   ```
   
   ```text
   cpu(0) [1. 1. 1.] [0. 0. 0.]
   gpu(0) [4.010342  4.002672  3.9972866] [10.002233  9.998462 10.000072]
   ```
   
   as you can see the variance and mean are erroneous on CPU, it is actually 
always ones for the variance, and 0 for the mean.

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