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


   ## Description
   
   The Autograd module throws an exception that was not caught: 
   ```
   Error in sys.excepthook:
   
   Original exception was:
   ```
   After the execution of the program.
   
   ## To Reproduce
   Below is a minimal example to reproduce the bug:
   ```python
   from mxnet import nd
   import mxnet as mx
   x = mx.np.zeros((10,))
   x.attach_grad()
   
   class Op(mx.autograd.Function):
       def forward(self, x):
           out = x + 1
           return out
   
       def backward(self, grad):
           grad_x = grad
           return grad_x
   
   op = Op()
   with mx.autograd.record():
       y = op(x)
       y.sum().backward()
   
   print(x.grad)
   ```
   
   However, it could successfully print the result
   ```
   [1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
   Error in sys.excepthook:
   
   Original exception was:
   ```
   
   ## Environment
   
   ```
   ----------Python Info----------
   Version      : 3.7.6
   Compiler     : GCC 7.3.0
   Build        : ('default', 'Jan  8 2020 19:59:22')
   Arch         : ('64bit', '')
   ------------Pip Info-----------
   Version      : 20.0.2
   Directory    : /home/***/anaconda3/lib/python3.7/site-packages/pip
   ----------MXNet Info-----------
   Version      : 1.6.0
   Directory    : /home/***/anaconda3/lib/python3.7/site-packages/mxnet
   Num GPUs     : 1
   Commit Hash   : 6eec9da55c5096079355d1f1a5fa58dcf35d6752
   ----------System Info----------
   Platform     : Linux-5.7.8-200.fc32.x86_64-x86_64-with-fedora-32-Thirty_Two
   system       : Linux
   node         : LAPTOP-24KAE66Q.lan
   release      : 5.7.8-200.fc32.x86_64
   version      : #1 SMP Thu Jul 9 14:34:51 UTC 2020
   ```
   


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


Reply via email to