You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/21 06:19:52 UTC

[GitHub] sxjscience opened a new issue #12268: Inconsistent type conversion from numpy.ndarray to mx.ndarray

sxjscience opened a new issue #12268: Inconsistent type conversion from numpy.ndarray to mx.ndarray
URL: https://github.com/apache/incubator-mxnet/issues/12268
 
 
   When we create a mxnet ndarray using a numpy ndarray, the dtype will not be automatically transferred. However, if we create a mxnet ndarray based on an existing mxnet ndarray, the dtype will be kept to be the same.
   
   Example: 
   ```python
   import mxnet as mx
   import numpy as np
   dat_np_to_mx = mx.nd.array(np.arange(10, dtype=np.int32))
   dat_mx_to_mx =mx.nd.array(mx.nd.arange(10, dtype=np.int32)) 
   print(dat_np_to_mx.dtype, dat_mx_to_mx.dtype)
   ```
   Result: 
   ```<class 'numpy.float32'> <class 'numpy.int32'>```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services