Skip to content

Fixed incorrect docs layout and a warning (2738) #2757

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

Merged
merged 2 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ random transformations applied on the batch of Tensor Images identically transfo


Scriptable transforms
^^^^^^^^^^^^^^^^^^^^^
---------------------

In order to script the transformations, please use ``torch.nn.Sequential`` instead of :class:`Compose`.

Expand All @@ -33,6 +33,8 @@ Make sure to use only scriptable transformations, i.e. that work with ``torch.Te

For any custom transformations to be used with ``torch.jit.script``, they should be derived from ``torch.nn.Module``.

Compositions of transforms
--------------------------

.. autoclass:: Compose

Expand Down
10 changes: 5 additions & 5 deletions torchvision/transforms/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ class ToPILImage:
Args:
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 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 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``,
``short``).
- 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 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``,
``short``).

.. _PIL.Image mode: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#concept-modes
"""
Expand Down