can you give the snippet of code that will reproduce this error?
Here’s code that I have that works fine:
import torch
import torchvision as vision

rc = vision.transforms.RandomCrop([224, 224])
toPIL = vision.transforms.ToPILImage()
toTensor = vision.transforms.ToTensor()

input = torch.randn(3, 256, 256)

out = toTensor(rc(toPIL(input)))
print(out.size())