Solved by KFrank in post #2 
              
              
                Hi Louis-Vincent! 

I haven’t looked at your code, but yes, in general the kind of thing 
you propose doing should work just fine. 
Make sure you understand the basics of how pytorch uses the 
require_grad property of a tensor.  Normally the weights, etc., 
of your model, and the tensors that depend…