You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/08/13 20:47:40 UTC
[GitHub] [incubator-mxnet] sxjscience commented on issue #18789: [bug] Autograd throws an exception that was not caught in MXNet 1.6
sxjscience commented on issue #18789:
URL: https://github.com/apache/incubator-mxnet/issues/18789#issuecomment-673702457
Actually I cannot reproduce this error. @yzh119 Would you try again with the latest nightly version and with the following code snippet?
To install the nightly version:
```
# Install the version with CUDA 10.0
python3 -m pip install -U --pre "mxnet-cu100>=2.0.0b20200802" -f https://dist.mxnet.io/python
# Install the version with CUDA 10.1
python3 -m pip install -U --pre "mxnet-cu101>=2.0.0b20200802" -f https://dist.mxnet.io/python
# Install the version with CUDA 10.2
python3 -m pip install -U --pre "mxnet-cu102>=2.0.0b20200802" -f https://dist.mxnet.io/python
# Install the cpu-only version
python3 -m pip install -U --pre "mxnet>=2.0.0b20200802" -f https://dist.mxnet.io/python
```
```python
from mxnet import nd
import mxnet as mx
mx.npx.set_np()
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)
```
----------------------------------------------------------------
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