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/10/24 07:51:23 UTC
[GitHub] wkcn edited a comment on issue #12843: MXNet doesn't work with
scipy int64
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
The id of np.int64 in scipy is different from that in numpy.
```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
```
In SciPy, the dtype `np.int64` is upcasted to `np.longlong`.
```
>>> np.int64 == np.longlong
False
>>> np.int64
<class 'numpy.int64'>
>>> np.longlong
<class 'numpy.int64'>
```
----------------------------------------------------------------
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