apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.77k stars 6.79k forks source link

Concatenate with empty array fails. #17005

Closed vjache closed 4 years ago

vjache commented 4 years ago

Description

mx.__version__
'1.5.0'
a1 = md.array([ [1,2,3], [4,5,6] ]) # shape = (2, 3)
a2 = a1[0: 0] # shape = (0, 3)
md.concatenate([a1,a2])

Error Message

  File "<input>", line 1, in <module>
  File "C:\Users\vjache\AppData\Roaming\Python\Python37\site-packages\mxnet\ndarray\ndarray.py", line 3795, in concatenate
    ret[idx:idx+arr.shape[0]] = arr
  File "C:\Users\vjache\AppData\Roaming\Python\Python37\site-packages\mxnet\ndarray\ndarray.py", line 449, in __setitem__
    self._set_nd_basic_indexing(key, value)
  File "C:\Users\vjache\AppData\Roaming\Python\Python37\site-packages\mxnet\ndarray\ndarray.py", line 739, in _set_nd_basic_indexing
    shape[i], slice_i.step)
  File "C:\Users\vjache\AppData\Roaming\Python\Python37\site-packages\mxnet\ndarray\ndarray.py", line 2328, in _get_index_range
    raise IndexError('Slicing start %d exceeds limit of %d' % (start, length))
IndexError: Slicing start 2 exceeds limit of 2

To Reproduce

See description.

Steps to reproduce

See description.

What have you tried to solve it?

The second array is automatically computed by algorithm, and at some edge case it produce a zero lenghted slice.

Environment

We recommend using our script for collecting the diagnositc information. Run the following command and paste the outputs below:

C:\Users\vjache\miniconda3\envs\entropy\python.exe C:/Users/vjache/PycharmProjects/entropy/diagnose.py
----------Python Info----------
Version      : 3.7.4
Compiler     : MSC v.1915 64 bit (AMD64)
Build        : ('default', 'Aug  9 2019 18:34:13')
Arch         : ('64bit', 'WindowsPE')
------------Pip Info-----------
Version      : 19.3.1
Directory    : C:\Users\vjache\miniconda3\envs\entropy\lib\site-packages\pip
----------MXNet Info-----------
Version      : 1.5.0
Directory    : C:\Users\vjache\AppData\Roaming\Python\Python37\site-packages\mxnet
Num GPUs     : 1
Hashtag not found. Not installed from pre-built package.
----------System Info----------
Platform     : Windows-10-10.0.18362-SP0
system       : Windows
node         : DESKTOP-FKP41K9
release      : 10
version      : 10.0.18362
----------Hardware Info----------
machine      : AMD64
processor    : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel
Name                                      
Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz  

----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0151 sec, LOAD: 0.7928 sec.
Timing for GluonNLP GitHub: https://github.com/dmlc/gluon-nlp, DNS: 0.0010 sec, LOAD: 0.7135 sec.
Timing for GluonNLP: http://gluon-nlp.mxnet.io, DNS: 0.1308 sec, LOAD: 0.2760 sec.
Timing for D2L: http://d2l.ai, DNS: 0.0823 sec, LOAD: 0.5318 sec.
Timing for D2L (zh-cn): http://zh.d2l.ai, DNS: 0.0420 sec, LOAD: 0.3652 sec.
Timing for FashionMNIST: https://repo.mxnet.io/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.1289 sec, LOAD: 1.0055 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.1225 sec, LOAD: 1.5063 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0546 sec, LOAD: 0.3528 sec.

Process finished with exit code 0
leezu commented 4 years ago

You need to use numpy compatible mode. Zero dim arrays are not supported otherwise. See https://github.com/apache/incubator-mxnet/issues/14253

vjache commented 4 years ago

Dear @leezu, I can't use the unexisting thing. I'm using Windows, and as you probably know it is not supported. See also: https://github.com/apache/incubator-mxnet/issues/15681#issuecomment-516114231 .

image

leezu commented 4 years ago

The page is outdated. Just install the normal nightly version or compile master version from source