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 2019/02/09 14:16:25 UTC

[GitHub] mseth10 opened a new issue #14105: nd.slice errors out when end=-1 and step=-1

mseth10 opened a new issue #14105: nd.slice errors out when end=-1 and step=-1
URL: https://github.com/apache/incubator-mxnet/issues/14105
 
 
   ### Description
   For `mxnet.ndarray.slice(data, begin, end)`, if `end=-1` and `step=-1`, it does not return a reversed tensor. Instead, it gives an invalid data error.
   
   ### Minimum reproducible environment
   ```
   >>> import mxnet.ndarray as nd
   >>> a = nd.normal(shape=(4))
   >>> a
   [2.2122064 0.7740038 1.0434405 1.1839255]
   <NDArray 4 @cpu(0)>a = nd.normal(shape=(4))
   >>> a1 = nd.slice(a, begin=2, end=-1, step=-1)
   ```
   Expected output: `[1.0434405 0.7740038 2.2122064]`
   Outputs:
   ```
   Traceback (most recent call last):
     File "test_slice.py", line 4, in <module>
       a1 = nd.slice(a, begin=2, end=-1, step=-1)
     File "<string>", line 86, in slice
     File "/home/ubuntu/workspace/mxnet0/python/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke
       ctypes.byref(out_stypes)))
     File "/home/ubuntu/workspace/mxnet0/python/mxnet/base.py", line 252, in check_call
       raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [13:57:39] /home/ubuntu/workspace/mxnet0/src/operator/tensor/./matrix_op-inl.h:716: Check failed: e < b (3 vs. 2) slicing with begin=[0]=2, end[0]=3, and step[0]=-1 is invalid
   ```
   ```

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