if link above to notebook for pytorch is right one. Looks like you are calling backwards on your loss function but with no Variable in it to compute gradients effectively making it useless. So your results are probably are probably coming up just random as the model is not learning anything and just using its random search policy. Without a tensor with Variable wrapper you can not auto compute your gradients with backward() and as only Variable I see code is set to require_grad=False nothing is being computed.