import torch
from torchvision.transforms import transforms
from PIL import Image
from pathlib import Path

trans = transforms.Compose([
    transforms.RandomHorizontalFlip(),
    transforms.Resize(32),
    transforms.CenterCrop(32),
    transforms.ToTensor(),
    transforms.Normalize((0.5, 0.5, 0.5),(0.5, 0.5, 0.5))
    ])

image = Image.open(Path(r'C:\Users\yasar\Desktop\as\RedBull07841.jpg'))
model.eval()

input = trans(image)

input = input.view(1, 3, 32,32)

output = model(input)

prediction = int(torch.max(output.data, 1)[1].numpy())
print(prediction)

if (prediction == 0):
    print ('ferrari')
if (prediction == 1):
    print ('mclaren')
if (prediction == 2):
    print ('mercedes')
if (prediction == 3):
    print ('redbull')

reesul : RuntimeError: shape ‘[1, 519840]’ is invalid for input of size 32