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 2018/03/06 20:38:05 UTC

[GitHub] lightingghost commented on issue #9979: Computing the second derivative

lightingghost commented on issue #9979: Computing the second derivative
URL: https://github.com/apache/incubator-mxnet/issues/9979#issuecomment-370919814
 
 
   I will suggest using `autograd.grad` for computing second order derivatives. like [here](https://mxnet.apache.org/api/python/autograd/autograd.html) A possible rewriting is 
   
   ```
   x = nd.array([3.0])
   x.attach_grad()
   with autograd.record():
       y = x**2
       y_grad = autograd.grad(y, x, create_graph=True, retain_graph=True)[0]
       z = y_grad ** 2
   z.backward()
   print(z.grad)
   ```

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