Solved by KFrank in post #2 
              
              
                Hi Vilayannur! 

I haven’t looked at your code in any detail, however: 

“breaks the computation graph” because 
Variable(loss, requires_grad = True) creates a new tensor 
(that also happens to be called loss), and (by design) gradients 
backpropagated to the new loss don’t get further backpropagate…