Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
11e49de4
Unverified
Commit
11e49de4
authored
Aug 22, 2023
by
Nicolas Hug
Committed by
GitHub
Aug 22, 2023
Browse files
clarifying docs for v2.ToPILImage() (#7864)
parent
26ed129d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
torchvision/transforms/v2/_type_conversion.py
torchvision/transforms/v2/_type_conversion.py
+4
-3
No files found.
torchvision/transforms/v2/_type_conversion.py
View file @
11e49de4
...
@@ -44,23 +44,24 @@ class ToImage(Transform):
...
@@ -44,23 +44,24 @@ class ToImage(Transform):
class
ToPILImage
(
Transform
):
class
ToPILImage
(
Transform
):
"""[BETA] Convert a tensor or an ndarray to PIL Image
- this does not scale values.
"""[BETA] Convert a tensor or an ndarray to PIL Image
.. v2betastatus:: ToPILImage transform
.. v2betastatus:: ToPILImage transform
This transform does not support torchscript.
This transform does not support torchscript.
Converts a torch.*Tensor of shape C x H x W or a numpy ndarray of shape
Converts a torch.*Tensor of shape C x H x W or a numpy ndarray of shape
H x W x C to a PIL Image while
preserv
ing the value range.
H x W x C to a PIL Image while
adjust
ing the value range
depending on the ``mode``
.
Args:
Args:
mode (`PIL.Image mode`_): color space and pixel depth of input data (optional).
mode (`PIL.Image mode`_): color space and pixel depth of input data (optional).
If ``mode`` is ``None`` (default) there are some assumptions made about the input data:
If ``mode`` is ``None`` (default) there are some assumptions made about the input data:
- If the input has 4 channels, the ``mode`` is assumed to be ``RGBA``.
- If the input has 4 channels, the ``mode`` is assumed to be ``RGBA``.
- If the input has 3 channels, the ``mode`` is assumed to be ``RGB``.
- If the input has 3 channels, the ``mode`` is assumed to be ``RGB``.
- If the input has 2 channels, the ``mode`` is assumed to be ``LA``.
- If the input has 2 channels, the ``mode`` is assumed to be ``LA``.
- If the input has 1 channel, the ``mode`` is determined by the data type (i.e ``int``, ``float``,
- If the input has 1 channel, the ``mode`` is determined by the data type (i.e ``int``, ``float``,
``short``).
``short``).
.. _PIL.Image mode: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#concept-modes
.. _PIL.Image mode: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#concept-modes
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment