Solved by ptrblck in post #4 
              
              
                torch.no_grad() will avoid storing the intermediate tensors during validation and testing and will thus save memory. 
model.eval() will change the behavior of some layers. E.g. it will disable dropout layers and use the running stats in batchnorm layers instead of the batch statistics. 
If you didn’…