You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by "Kan Wu (JIRA)" <ji...@apache.org> on 2018/10/25 09:38:00 UTC
[jira] [Created] (MXNET-1174) Support np.longlong on Linux and Fix
issue #12843
Kan Wu created MXNET-1174:
-----------------------------
Summary: Support np.longlong on Linux and Fix issue #12843
Key: MXNET-1174
URL: https://issues.apache.org/jira/browse/MXNET-1174
Project: Apache MXNet
Issue Type: Bug
Reporter: Kan Wu
## Description ##
On Linux x64, `str(numpy.longlong)` is "<class 'numpy.int64'>", however `numpy.longlong != numpy.int64`.
Their in-build numpy types are different.
`np.int64 == np.longlong` is True on Windows, False on Linux.
`np.dtype(np.longlong).char` is 'q' on Windows x64 and Linux x64.
`np.dtype(np.int64).char` is 'q' on Windows x64, 'l' on Linux x64.
In fact, the C types of `np.longlong` and `np.int64` are the same.
For the following code,
```python
import mxnet as mx
import numpy as np
a = mx.nd.array([1,2,3], dtype=np.longlong)
print (a, a.dtype)
```
MXNet will raise the exception:
```
File "/home/wkcn/proj/incubator-mxnet/python/mxnet/ndarray/ndarray.py", line 139, in _new_alloc_handle
ctypes.c_int(int(_DTYPE_NP_TO_MX[np.dtype(dtype).type])),
KeyError: <type 'numpy.int64'>
```
I use `np.dtype(data_type).name` to get the name of C type to solve the problem.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org