It depends how you’ve read the images in your Dataset. The DataLoader just calls Dataset's __getitem__ method.
Did you use torchvision.datasets.ImageFolder 323?
If so, the images were probably loaded with PIL, if you didn’t install accimage.
You can find the line of code here 218.
However, you need to provide the batch dimension at dim0, so your code would look like this:
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)