Solved by albanD in post #2 
              
              
                Hi, 
The problem I see here is that the first optimizer.step() is modifying the parameters of your network inplace. But the original values of these parameters are needed to compute the second backward. 
Hence the error that you see. 
You will have to either delay the optimizer step or redo the forw…