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 2017/11/01 05:11:16 UTC

[GitHub] John-Boik opened a new issue #8495: test_cross_device_autograd fails

John-Boik opened a new issue #8495: test_cross_device_autograd fails
URL: https://github.com/apache/incubator-mxnet/issues/8495
 
 
   A snippet of code to test auto-differentiation across devices fails on my machine and I don't understand why.  The code is copied from the test_cross_device_autograd function in [test_operator_gpu.py](test_operator_gpu.py).
    
   The following fails:
   ```
   from mxnet import nd, autograd
   x = nd.random_uniform(shape=(10,))
   x.attach_grad()
   with autograd.record():        
       y = nd.tanh(x)
       y = y.copyto(mx.gpu(0))
       #y.attach_grad()
       y.backward()
   ```
   The error message is:
   `src/ndarray/autograd.cc:237: Check failed: !i.entry_.is_none() Cannot differentiate node because it is not in a computational graph. You need to set is_recording to true or use autograd.record() to save computational graphs for backward. If you want to differentiate the same graph twice, you need to pass retain_graph=True to backward.`
   However, if I uncomment the y.attach_grad() line, then there is no error.
   I'm using mxnet v.11.0, python3, and ububtu 16.04.  Can anyone explain why an extra call to attach_grad() is required, and is this expected behavior now (is the test code outdated)? 

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


With regards,
Apache Git Services