sxjscience opened a new issue #16887: [Numpy] Bug of basic indexing
URL: https://github.com/apache/incubator-mxnet/issues/16887
 
 
   Found this bug when writing random test cases for symbolic indexing.
   
   ```python
   import mxnet as mx
   from mxnet import gluon
   mx.npx.set_np()
   
   a = mx.np.random.normal(0, 1, (5, 5, 5, 5))
   b = mx.np.random.normal(0, 1, (5, 5, 5, 5))
   index1 = (slice(3, 0, -1), slice(1, 0, -1), slice(2, 0, -1), slice(3, 0, -1))
   index2 = (slice(2, 3, 2), slice(0, 1, 2), slice(1, 2, 2), slice(1, 3, 2))
   
   class Foo(gluon.HybridBlock):
       def hybrid_forward(self, F, x, y):
           return (x[()][index1] + y[()][index1])[index2]
   
   net = Foo()
   with mx.autograd.record():
       out = net(a, b)
   ```
   
   Error:
   ```
   MXNetError: [07:04:22] src/ndarray/ndarray.cc:263: Check failed: 
shape_.Size() == shape.Size() (2 vs. 1) : NDArray.Reshape: target shape must 
have the same size as current shape when recording with autograd.
   Stack trace:
     [bt] (0) 
/home/ubuntu/mxnet/python/mxnet/../../lib/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x32)
 [0x7f1da2489c42]
     [bt] (1) 
/home/ubuntu/mxnet/python/mxnet/../../lib/libmxnet.so(mxnet::NDArray::ReshapeWithRecord(mxnet::TShape
 const&)+0x187) [0x7f1da59d4877]
     [bt] (2) 
/home/ubuntu/mxnet/python/mxnet/../../lib/libmxnet.so(MXNDArrayReshape64+0xa7) 
[0x7f1da612f2e7]
     [bt] (3) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c)
 [0x7f1e6fc14e20]
     [bt] (4) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x2eb)
 [0x7f1e6fc1488b]
     [bt] (5) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x49a)
 [0x7f1e6fc0f01a]
     [bt] (6) 
/usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x9fcb) 
[0x7f1e6fc02fcb]
     [bt] (7) /usr/bin/python3(PyObject_Call+0x47) [0x5c3bd7]
     [bt] (8) /usr/bin/python3(PyEval_EvalFrameEx+0x4f2f) [0x5354af]
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to