Solved by albanD in post #2 
              
              
                Hi, 
You need to set create_graph=True to get the graph constructed when using autograd.grad (and thus the gradients that can require gradients. See doc for more details. 
This had a different behavior in 0.3.1 as can be seen in the old doc where this flag was set to True if the gradients provided a…