Skip to content

PILToTensor input shape description is wrong/confusing #9221

@nicolasdumitru

Description

@nicolasdumitru

📚 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).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions