According to the link below, we don’t need to do model.zero_grad() as the model is in eval mode.

  
    
    
    Backprop in PyTorch? 
  
  
    Hi, 
So pytorch is very different from tensorflow in the sense that your don’t create the graph once, and then just backprop through it. 
The whole framework is built such that the graph is super cheat to build and so it is built on the fly. 
That means that for every input for which you want to compute backprop, you should execute your computation with them, and then call backward on the output. 
In your case, you should have: 
import torch
import torch.nn as nn
from torch.autograd import Varia…