from PIL import Image import torchvision.transforms.functional as TF image = Image.open('YOUR_PATH') x = TF.to_tensor(image) x.unsqueeze_(0) print(x.shape) output = model(X)