Skip to content

Commit 11e49de

Browse files
authored
clarifying docs for v2.ToPILImage() (#7864)
1 parent 26ed129 commit 11e49de

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

torchvision/transforms/v2/_type_conversion.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,24 @@ def _transform(
4444

4545

4646
class ToPILImage(Transform):
47-
"""[BETA] Convert a tensor or an ndarray to PIL Image - this does not scale values.
47+
"""[BETA] Convert a tensor or an ndarray to PIL Image
4848
4949
.. v2betastatus:: ToPILImage transform
5050
5151
This transform does not support torchscript.
5252
5353
Converts a torch.*Tensor of shape C x H x W or a numpy ndarray of shape
54-
H x W x C to a PIL Image while preserving the value range.
54+
H x W x C to a PIL Image while adjusting the value range depending on the ``mode``.
5555
5656
Args:
5757
mode (`PIL.Image mode`_): color space and pixel depth of input data (optional).
5858
If ``mode`` is ``None`` (default) there are some assumptions made about the input data:
59+
5960
- If the input has 4 channels, the ``mode`` is assumed to be ``RGBA``.
6061
- If the input has 3 channels, the ``mode`` is assumed to be ``RGB``.
6162
- If the input has 2 channels, the ``mode`` is assumed to be ``LA``.
6263
- If the input has 1 channel, the ``mode`` is determined by the data type (i.e ``int``, ``float``,
63-
``short``).
64+
``short``).
6465
6566
.. _PIL.Image mode: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#concept-modes
6667
"""

0 commit comments

Comments
 (0)