Your current code is a bit hard to read, so please format it by wrapping it into three backticks ```.
Also, remove the usage of Variable, as it’s deprecated since PyTorch 0.4 as well as the usage of the .data attribute, as it might yield unwanted side effects.
In the test_loader loop it seems you are not wrapping the code into a with torch.no_grad() block, so you might want to add it.