The model.eval() should have been outside the training loop. I wrote that erroneously.
Also, thanks for the clarification.
I am adding the torch.no_grad() in the training loop just after the model.eval() part. I guess that won’t raise an alarm.