Solved by albanD in post #2 
              
              
                Hi, 
loss.grad is expected to remain None as only the gradients for leaf variables are saved in the .grad field. 
These two lines 
net2.weight.data = y[0][0].reshape(-1,1) # using the output from first net as parameter to second net2.bias.data = y[0][1].reshape(-1,1)    

Use .data and thus break th…