-
Notifications
You must be signed in to change notification settings - Fork 7.2k
handle I;16 mode in pil_to_tensor #9457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 7 commits
8864dc0
088b339
2ad73ef
71cf622
1fe1709
3fbe21e
aefaae1
2e714ac
2813bc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,15 @@ have values in ``[0, MAX_DTYPE]`` where ``MAX_DTYPE`` is the largest value | |
| that can be represented in that dtype. Typically, images of dtype | ||
| ``torch.uint8`` are expected to have values in ``[0, 255]``. | ||
|
|
||
| .. note:: | ||
|
|
||
| ``torch.uint16``, ``torch.uint32``, and ``torch.uint64`` dtypes are not | ||
| officially supported by the torchvision transforms. While some operations | ||
| may work, most transforms expect ``torch.uint8`` or ``torch.float32`` | ||
| inputs. If you're working with uint16 images (e.g. from 16-bit medical or | ||
| scientific imaging), consider converting to ``float32`` first using | ||
| :class:`~torchvision.transforms.v2.ToDtype`. | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can put this note after "Use :class:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved it there in the latest commit. |
||
| Use :class:`~torchvision.transforms.v2.ToDtype` to convert both the dtype and | ||
| range of the inputs. | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason we mention the uint16-to-float32 conversion specifically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no specific reason, dropped that bit in the latest commit. the note just lists the unsupported dtypes now.