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/01/23 14:37:31 UTC

[GitHub] Rikorose opened a new issue #9531: KeyError: in mx.nd.array.empty()

Rikorose opened a new issue #9531: KeyError: <class 'numpy.object_'> in mx.nd.array.empty()
URL: https://github.com/apache/incubator-mxnet/issues/9531
 
 
   ## Description
   This error occurred when I used a batch size > 1 in the traceback of `default_batchify_fn()`. It also is not 100% reproducible, when I set a break point in `default_batchify_fn()` it does not throw the error.
   
   Traceback:
   ```py
   Connected to pydev debugger (build 173.4301.16)
   /usr/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py:46: DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom instead
     import OpenSSL.SSL
   Traceback (most recent call last):
     File "/home/rik/PyCharm/pycharm-2017.2.3/helpers/pydev/pydevd.py", line 1668, in <module>
       main()
     File "/home/rik/PyCharm/pycharm-2017.2.3/helpers/pydev/pydevd.py", line 1662, in main
       globals = debugger.run(setup['file'], None, None, is_module)
     File "/home/rik/PyCharm/pycharm-2017.2.3/helpers/pydev/pydevd.py", line 1072, in run
       pydev_imports.execfile(file, globals, locals)  # execute the script
     File "/home/rik/PyCharm/pycharm-2017.2.3/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
       exec(compile(contents+"\n", file, 'exec'), glob, loc)
     File "/home/rik/projects/test-mxnet/train.py", line 236, in <module>
       main()
     File "/home/rik/projects/test-mxnet/train.py", line 223, in main
       train(model, train_iter, test_iter, val_iter, ctx)
     File "/home/rik/projects/test-mxnet/train.py", line 124, in train
       for i, (label, data) in enumerate(train_data):
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 206, in __iter__
       yield self._batchify_fn([self._dataset[idx] for idx in batch])
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 93, in default_batchify_fn
       return [default_batchify_fn(i) for i in data]
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 93, in <listcomp>
       return [default_batchify_fn(i) for i in data]
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/gluon/data/dataloader.py", line 96, in default_batchify_fn
       return nd.array(data, dtype=data.dtype)
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/ndarray/utils.py", line 146, in array
       return _array(source_array, ctx=ctx, dtype=dtype)
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 2244, in array
       arr = empty(source_array.shape, ctx, dtype)
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 3415, in empty
       return NDArray(handle=_new_alloc_handle(shape, ctx, False, dtype))
     File "/home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py", line 138, in _new_alloc_handle
       ctypes.c_int(int(_DTYPE_NP_TO_MX[np.dtype(dtype).type])),
   KeyError: <class 'numpy.object_'>
   ```
   
   The data contains a label and a feature numpy array per batch:
   ![screenshot](https://user-images.githubusercontent.com/16517898/35281325-ee600a7e-0052-11e8-8971-f90bfaeeafa6.png)
   
   
   
   ## Environment info (Required)
   
   ```py
   (mxnet) [rik@localhost test-mxnet]$ python diagnose.py 
   ----------Python Info----------
   Version      : 3.6.3
   Compiler     : GCC 7.2.1 20170915 (Red Hat 7.2.1-2)
   Build        : ('default', 'Oct  9 2017 12:07:10')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 9.0.1
   Directory    : /home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/pip
   ----------MXNet Info-----------
   /usr/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py:46: DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom instead
     import OpenSSL.SSL
   Version      : 1.0.0
   Directory    : /home/rik/.virtualenvs/mxnet/lib/python3.6/site-packages/mxnet
   Commit Hash   : fe80b1c812237ca228fdff4fe48f3b13eb69bc3e
   ----------System Info----------
   Platform     : Linux-4.14.13-300.fc27.x86_64-x86_64-with-fedora-27-Twenty_Seven
   system       : Linux
   node         : localhost.localdomain
   release      : 4.14.13-300.fc27.x86_64
   version      : #1 SMP Thu Jan 11 04:00:01 UTC 2018
   ----------Hardware Info----------
   machine      : x86_64
   processor    : x86_64
   Architecture:        x86_64
   CPU op-mode(s):      32-bit, 64-bit
   Byte Order:          Little Endian
   CPU(s):              4
   On-line CPU(s) list: 0-3
   Thread(s) per core:  2
   Core(s) per socket:  2
   Socket(s):           1
   NUMA node(s):        1
   Vendor ID:           GenuineIntel
   CPU family:          6
   Model:               61
   Model name:          Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
   Stepping:            4
   CPU MHz:             2579.937
   CPU max MHz:         2700.0000
   CPU min MHz:         500.0000
   BogoMIPS:            4389.71
   Virtualization:      VT-x
   L1d cache:           32K
   L1i cache:           32K
   L2 cache:            256K
   L3 cache:            3072K
   NUMA node0 CPU(s):   0-3
   Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti retpoline intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap xsaveopt dtherm ida arat pln pts
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0305 sec, LOAD: 1.0356 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.3520 sec, LOAD: 0.0851 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.8572 sec, LOAD: 0.1458 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0618 sec, LOAD: 0.9015 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0379 sec, LOAD: 0.2552 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0290 sec, LOAD: 0.5309 sec.
   
   ```
   

----------------------------------------------------------------
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