Have a look here:

  
      github.com/pytorch/pytorch
  
  
    
  
	  
  

  
    
      BatchNorm behaves different in train() and eval() 95
    

    
      
        opened 
        
          
        
        Feb 26, 2018
      
      

        
          closed 
        
          
        
        Feb 26, 2018
      
        

      
        
          
          yuandong-tian
        
      
    
  



  import torch
import torch.nn as nn
from torch.autograd import Variable
print(torch.__version__)
def get_data(cuda=False):
 if cuda:
 return torch.cuda.FloatTensor(32, 1, 19, 19)
 else:
 return torch.FloatTensor(32, 1, 19,...





  
  
    
    
  
  


In short: in eval model batch norm doesn’t calculate the statistics of the current batch, that may lead to your issue.