(Newbie Question) Getting the gradient of output with respect to the input

y.grad is the gradient of a non-leaf variable. To access it’s gradient, you have to use a backward hook:

1 Like