I encountered an error and with a little googling, just in case anyone also find this problem,
I’ve changed the code into this because the model is on GPU 
thank you! my single prediction image worked!
x_test = data_transforms['val'](img).to(device)

Now when I want to predict an entire folder, what’s the pseudocode?