xidulu commented on issue #16460: numpy -> mxnet -> numpy gives arrays with strange behavior URL: https://github.com/apache/incubator-mxnet/issues/16460#issuecomment-541427480 Hi @vafl I did the following experiment: ``` In [1]: import numpy as np In [2]: n = 1_000_000 In [3]: x = np.array([100.0, -100.0])[None, :].repeat(repeats=n, axis=0) In [4]: x.dtype Out[4]: dtype('float64') In [5]: x.astype('float32').std(axis=0) Out[5]: array([1.3201232, 1.3201232], dtype=float32) In [6]: import mxnet as mx In [7]: u = mx.nd.array(x) In [8]: u.dtype Out[8]: numpy.float32 ``` It seems that the root causes of your problem are: 1. The type conversion between Numpy.ndarray and mx.ndarray. 2. The numerical error from Numpy. I would suggest you could either raise this issue in Numpy's repo or manually declare the array's dtype using `.astype('float64')`.
---------------------------------------------------------------- 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
