You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/02/20 15:17:55 UTC

[GitHub] [incubator-mxnet] DNXie opened a new issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

DNXie opened a new issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941


   ## Description
   `mxnet.ndarray.take` crashes(segfault and floating point exception) when `a` is empty
   
   ### Error Message
   Floating point exception and segmentation fault
   
   ## To Reproduce
   
   This input throws floating point exception, the [gist](https://colab.research.google.com/drive/1sucj581DPV11dIfUkJZ-qFdO5QfWoOYY?usp=sharing)
   ~~~python
   import mxnet
   mxnet.ndarray.take(indices = mxnet.nd.array((3, 8, 19, 2)), a=mxnet.nd.array(np.ones((0))), mode='wrap')
   ~~~
   
   
   Without passing `wrap`, it throws segfault
   ~~~python
   import mxnet
   mxnet.ndarray.take(indices = mxnet.nd.array((3, 8, 19, 2)), a=mxnet.nd.array(np.ones((0))))
   ~~~
   
   ## Environment
   
   OS: ubuntu 18.04
   Python: 3.7.6
   pip: 20.0.2
   numpy: 1.18.5
   mxnet: 1.6.0


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC edited a comment on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786192874


   I guess that clip should also work (by design) too for this corner case as it should raise the error.
   The numpy reference is [Fix indexing behavior when input is zero-sized array](https://github.com/cupy/cupy/pull/1503/files) 
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] wkcn removed a comment on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
wkcn removed a comment on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-782772898


   Thank you for the report!
   
   I reproduce the bug on MXNet 2.0.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC commented on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC commented on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786192874


   I guess that clip should also work (by design) too for this corner case as it should raise the error.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] wkcn commented on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
wkcn commented on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-782772898


   Thank you for the report!
   
   I reproduce the bug on MXNet 2.0.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC edited a comment on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786192874


   I guess that clip should also work (by design) too for this corner case as it should raise the error.
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC edited a comment on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786152088


   In the c++ backend code, it only reports an error when the mode set as 'raise'. 
   [indexing_op.h#L542](https://github.com/apache/incubator-mxnet/blob/5070f1abb9c8198bd7706ff3a16a0d8b8836b822/src/operator/tensor/indexing_op.h#L542)
   @szha Should it follow the NumPy way of reports error when the index out of range?


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC edited a comment on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786152088


   In the c++ backend code, it only reports an error when the mode set as 'raise'. 
   [indexing_op.h#L542](https://github.com/apache/incubator-mxnet/blob/5070f1abb9c8198bd7706ff3a16a0d8b8836b822/src/operator/tensor/indexing_op.h#L542)
   @szha Should it follow the NumPy way of reporting an error when the index out of range?
   [update] Seems the default behavior is 'clip' for MXNet.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC edited a comment on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786192874


   I guess that clip should also work (by design) too for this corner case as it should raise the error.
   Numpy shows this error message for clip mode:
   ```
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "<__array_function__ internals>", line 6, in take
     File "/home/tristonc/anaconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 194, in take
       return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
     File "/home/tristonc/anaconda3/lib/python3.7/site-packages/numpy/core/fromnumeric.py", line 61, in _wrapfunc
       return bound(*args, **kwds)
   IndexError: cannot do a non-empty take from an empty axes.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] DNXie commented on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
DNXie commented on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-783585971


   BTW, `mxnet.ndarray.op.take` also crashes with the same input
   
   ~~~python
   import mxnet
   import numpy as np
   mxnet.ndarray.op.take(indices = mxnet.nd.array((3, 8, 19, 2)), a=mxnet.nd.array(np.ones((0))), mode='wrap')
   ~~~


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC edited a comment on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC edited a comment on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786152088


   In the c++ backend code, it only reports an error when the mode set as 'raise'. 
   [indexing_op.h#L542](https://github.com/apache/incubator-mxnet/blob/5070f1abb9c8198bd7706ff3a16a0d8b8836b822/src/operator/tensor/indexing_op.h#L542)
   @szha Should it follow the NumPy way of reports error when the index out of range?
   [update] Seems the default behavior is 'clip' for MXNet.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] TristonC commented on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
TristonC commented on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-786152088


   In the c++ backend code, it only reports an error when the mode set as 'raise'. 
   [indexing_op.h#L542](https://github.com/apache/incubator-mxnet/blob/5070f1abb9c8198bd7706ff3a16a0d8b8836b822/src/operator/tensor/indexing_op.h#L542)
   @szhaShould it follow the NumPy way of reports error when the index out of range?


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org


[GitHub] [incubator-mxnet] wkcn commented on issue #19941: mxnet.ndarray.take crashes(segfault and floating point exception)

Posted by GitBox <gi...@apache.org>.
wkcn commented on issue #19941:
URL: https://github.com/apache/incubator-mxnet/issues/19941#issuecomment-782773657


   Thank you for the report!
   
   I reproduce it on MXNet 2.0.
   
   It is an invalid input, and NumPy will raise an exception.
   ```python
   >>> np.take(a = np.ones(0), indices=np.array([3, 8, 19, 2]))
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "<__array_function__ internals>", line 5, in take
     File "/usr/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 191, in take
       return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
     File "/usr/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 58, in _wrapfunc
       return bound(*args, **kwds)
   IndexError: cannot do a non-empty take from an empty axes.
   ```
   
   However, the invalid input makes the program crash on MXNet.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org