How to feed my picture to the resnet model?

I used the resnet50 model in torchvision.models to train a classification model.Now I want load a new picture to predict.It works when I use the to feed the picture to my model,but when I load the picture and change it to a torch.Tensor,it dosn’t work.They are all <class ‘torch.Tensor’>,and have same size.The error is size mismatch, m1: [1 x 8192], m2: [2048 x 100].What should I do?Please help me.

inputs, classes = next(test_dataloader)

sample = test_datasets.getitem(0)
img = sample[0].float()

model_test = ‘resnet50_1’
model_ft = torch.load(model_dir+model_test)
img =
outputs = model_ft(img)
_, preds = torch.max(outputs, 1)

Your images should be [batch_size, 3, 224, 224].
It looks like a small typo to resize img to [1, 3, 244, 244].

yes i know,but my batch size is 1,they are all [1,3,244,244]

The error comes from the width and height.
They should be 224 instead of 244.
Sorry for making it not clear in the first answer.