Solved by mariosasko in post #6 
              
              
                It should look like this: 
@torch.no_grad()
def test(data_loader, net):
    net.eval()
    # the rest of the code

Please check the docs for any further questions.