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
357a40f1
Unverified
Commit
357a40f1
authored
Jun 27, 2023
by
Sahil Goyal
Committed by
GitHub
Jun 27, 2023
Browse files
clarifying docs for ToPILImage() (#7679)
Co-authored-by:
Nicolas Hug
<
nh.nicolas.hug@gmail.com
>
parent
52eb5039
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
torchvision/transforms/transforms.py
torchvision/transforms/transforms.py
+4
-4
No files found.
torchvision/transforms/transforms.py
View file @
357a40f1
...
@@ -199,21 +199,21 @@ class ConvertImageDtype(torch.nn.Module):
...
@@ -199,21 +199,21 @@ class ConvertImageDtype(torch.nn.Module):
class
ToPILImage
:
class
ToPILImage
:
"""Convert a tensor or an ndarray to PIL Image
- this does not scale values.
"""Convert a tensor or an ndarray to PIL Image
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