Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

[bug] Autograd throws an exception that was not caught in MXNet 1.6 #18789

Open
@yzh119

Description

@yzh119

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:

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions