You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by "Deokjae Lee (JIRA)" <ji...@apache.org> on 2018/04/06 14:03:00 UTC

[jira] [Created] (MXNET-291) Fix an ndarray indexing bug with index -1

Deokjae Lee created MXNET-291:
---------------------------------

             Summary: Fix an ndarray indexing bug with index -1
                 Key: MXNET-291
                 URL: https://issues.apache.org/jira/browse/MXNET-291
             Project: Apache MXNet
          Issue Type: Bug
            Reporter: Deokjae Lee


```python
x = mx.nd.array([[1,2,3],[4,5,6]])
print(x[-1,:])  # MXNetError
print(x[:,-1])  # MXNetError
print(x[-1,-1]) # MXNetError
```
This produces MXNetErrors while it is expected to print `[1, 4]`, `[3, 6]` and `6`. The errors are like
```
src/operator/tensor/./matrix_op-inl.h:675: Check failed: b < e (1 vs. 0) slicing with 
begin=[0]=1, end[0]=0, and step[0]=1 is invalid
```
Other negative indices (-2 and -3) work as expected and expressions like `x[-1]` and `x[:,-2:-1]` are also ok. So the error occurs only if -1 is used in a multidimensional index but not a part of a slice expression. This PR fixes the bug.




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