Skip to content

Commit

Permalink
Clarify scaling of ToTensor transform for target masks in the documen…
Browse files Browse the repository at this point in the history
…tation (#2507)

* Clarify scaling of ToTensor transform for target masks in the documentation

* Add link to the segmentation reference

Co-authored-by: vfdev <vfdev.5@gmail.com>

Co-authored-by: vfdev <vfdev.5@gmail.com>
  • Loading branch information
Areiser and vfdev-5 committed Aug 3, 2020
1 parent 62e3fbd commit 7fc47ea
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions torchvision/transforms/transforms.py
Expand Up @@ -72,6 +72,12 @@ class ToTensor(object):
or if the numpy.ndarray has dtype = np.uint8
In the other cases, tensors are returned without scaling.
.. note::
Because the input image is scaled to [0.0, 1.0], this transformation should not be used when
transforming target image masks. See the `references`_ for implementing the transforms for image masks.
.. _references: https://github.com/pytorch/vision/tree/master/references/segmentation
"""

def __call__(self, pic):
Expand Down

0 comments on commit 7fc47ea

Please sign in to comment.