wkcn edited a comment on issue #12843: MXNet doesn't work with scipy int64
URL: 
https://github.com/apache/incubator-mxnet/issues/12843#issuecomment-432537269
 
 
   In SciPy, the dtype `np.int64` is upcasted to `np.longlong` when 
`csr_matrix` is called.
   ```
   >>> np.int64 == np.longlong
   False
   >>> np.int64
   <class 'numpy.int64'>
   >>> np.longlong
   <class 'numpy.int64'>
   ```
   Please see the link: 
https://github.com/scipy/scipy/blob/master/scipy/sparse/coo.py#L358
   
   ```python
   import numpy as np
   import scipy as sp
   import mxnet as mx
   
   one = np.ones((2, 2), dtype='int64')
   sp_one = sp.sparse.csr_matrix(one).data
   
   print (np.dtype(sp_one.dtype).type)
   print (id(np.dtype(sp_one.dtype).type))
   
   print (np.dtype(np.int64).type)
   print (id(np.dtype(np.int64).type))
   
   print (np.int64)
   print (id(np.int64))
   ```
   
   ```bash
   <type 'numpy.int64'>
   139671667680256
   <type 'numpy.int64'>
   139671667680672
   <type 'numpy.int64'>
   139671667680672
   ```

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to