## Minimum reproducible example
'''
from mxnet import ndarray as nd
import numpy as np
# Declare an mxnet ndarray
x = nd.array(range(5))
print(x)
# Try an out of bound index
idx = [5]
print('mxnet:',x[idx])
'''
## Output:
'''
[0. 1. 2. 3. 4.]
<NDArray 5 @cpu(0)>
mxnet:
[-3.689349e+19]
<NDArray 1 @cpu(0)>
'''
Note that there is no complaint what-so-ever. Not even a warning.
On the other hand, if you do the following instead:
'''
# indexing with integer
idx=5
x[idx]
'''
Then you get the desired error message:
'''
IndexError: index 5 is out of bounds for axis 0 with size 5
'''
[ Full content available at:
https://github.com/apache/incubator-mxnet/issues/12389 ]
This message was relayed via gitbox.apache.org for [email protected]