Solved by KFrank in post #7 
              
              
                Hello Capo! 

You are correct; this does break the computation graph. 

In order to be able to backpropagate through the minimize() part 
of your loss-function computation, pytorch has to be able to get the 
gradient of minimize()'s output with respect to its input. 
You have two choices: 
You can w…