saswatac commented on issue #11551: NDArray __getitem__  reads invalid memory 
with advanced indexing and negative indices 
URL: 
https://github.com/apache/incubator-mxnet/issues/11551#issuecomment-405750259
 
 
   To add to this, I have observed it is not only negative index, but it is for 
any positive out of bound index.
   
   Further assignment to a out of bound index results in non-deterministic 
behavior. The assignment is either silently ignored or it fails with a SIGSEV 
or SIGABRT.
   
   silently ignored -
   ```
   arr = mx.ndarray.ones((10,))
   arr[np.array([10], dtype=np.int)] = 2
   print arr
   ```
   
   SIGABRT -
   ```
   arr = mx.ndarray.ones((10,))
   for i in range(10):
       arr[np.array([10], dtype=np.int)] = 2
   print arr
   ```
   
   SIGSEGV - 
   
   ```
   arr = mx.ndarray.ones((10,))
   for i in range(10):
       arr[np.array([11,12], dtype=np.int)] = [2,2]
   print arr
   ```
   
   For all these cases of assignment as well as retrieval, we should be failing 
with a index out of bound error , which is the behavior in numpy for these 
cases.
   
   
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to