apeforest commented on issue #14340: [bug] Bug in Gradient flow with 
backward(retain_graph=True) and split()
URL: 
https://github.com/apache/incubator-mxnet/issues/14340#issuecomment-470286826
 
 
   @ThomasDelteil
   I ran it on CPU and didn't get core dump. Here is my output:
   
   ```
   [[1. 1. 1. 1. 1. 0. 0. 0. 0. 0.]]
   [[0. 0. 0. 0. 0. 1. 1. 1. 1. 1.]]
   
   [[1. 1. 1. 1. 1. 0. 0. 0. 0. 0.]]
   [[0. 0. 0. 0. 0. 1. 1. 1. 1. 1.]]
   
   [[1. 1. 1. 1. 1. 0. 0. 0. 0. 0.]]
   [[0. 0. 0. 0. 0. 1. 1. 1. 1. 1.]]
   
   [[1. 1. 1. 1. 1. 0. 0. 0. 0. 0.]]
   [[0. 0. 0. 0. 0. 1. 1. 1. 1. 1.]]
   ```
   
   We also have a unit test to cover split operator with gradient:
   tests/python/unittest/test_infer_type.py
   
   ```
   def test_split()
       data = mx.nd.arange(16, dtype=np.float64).reshape((4, 4))
       data.attach_grad()
       with autograd.record():
           y = mx.nd.split(data, axis=0, num_outputs=2)
       y[0].backward()
       assert data.grad.dtype == np.float64
   ```

----------------------------------------------------------------
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


With regards,
Apache Git Services

Reply via email to