📚 The doc issue
The PILToTensor documentation pages (for both torchvision.transforms.v2.PILToTensor and torchvision.transforms.PILToTensor) state:
Converts a PIL Image (H x W x C) to a Tensor of shape (C x H x W).
This is confusing, because img.size returns the dimensions of a PIL.Image (img, in this case) in (width, height) format.
Suggest a potential alternative/fix
Change the quoted statement to the following:
Converts a PIL Image (W x H x C) to a Tensor of shape (C x H x W).