Solved by albanD in post #2 
              
              
                Hi, 
You need to make sure to pass create_graph=True the first time you run autograd.grad (or backward()) to be able to backward through that. 
Also you can use the autograd.functional.jacobian(..., create_graph=True) to get the full Jacobian directly.