Skip to content

Commit 993325d

Browse files
authored
Minor additions to Resize docs (#4138)
1 parent a83b9a1 commit 993325d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

torchvision/transforms/functional.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ def resize(img: Tensor, size: List[int], interpolation: InterpolationMode = Inte
346346
The output image might be different depending on its type: when downsampling, the interpolation of PIL images
347347
and tensors is slightly different, because PIL applies antialiasing. This may lead to significant differences
348348
in the performance of a network. Therefore, it is preferable to train and serve a model with the same input
349-
types.
349+
types. See also below the ``antialias`` parameter, which can help making the output of PIL images and tensors
350+
closer.
350351
351352
Args:
352353
img (PIL Image or Tensor): Image to be resized.
@@ -372,8 +373,9 @@ def resize(img: Tensor, size: List[int], interpolation: InterpolationMode = Inte
372373
if ``size`` is an int (or a sequence of length 1 in torchscript
373374
mode).
374375
antialias (bool, optional): antialias flag. If ``img`` is PIL Image, the flag is ignored and anti-alias
375-
is always used. If ``img`` is Tensor, the flag is False by default and can be set True for
376-
``InterpolationMode.BILINEAR`` only mode.
376+
is always used. If ``img`` is Tensor, the flag is False by default and can be set to True for
377+
``InterpolationMode.BILINEAR`` only mode. This can help making the output for PIL images and tensors
378+
closer.
377379
378380
.. warning::
379381
There is no autodiff support for ``antialias=True`` option with input ``img`` as Tensor.

torchvision/transforms/transforms.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ class Resize(torch.nn.Module):
233233
The output image might be different depending on its type: when downsampling, the interpolation of PIL images
234234
and tensors is slightly different, because PIL applies antialiasing. This may lead to significant differences
235235
in the performance of a network. Therefore, it is preferable to train and serve a model with the same input
236-
types.
236+
types. See also below the ``antialias`` parameter, which can help making the output of PIL images and tensors
237+
closer.
237238
238239
Args:
239240
size (sequence or int): Desired output size. If size is a sequence like
@@ -258,8 +259,9 @@ class Resize(torch.nn.Module):
258259
if ``size`` is an int (or a sequence of length 1 in torchscript
259260
mode).
260261
antialias (bool, optional): antialias flag. If ``img`` is PIL Image, the flag is ignored and anti-alias
261-
is always used. If ``img`` is Tensor, the flag is False by default and can be set True for
262-
``InterpolationMode.BILINEAR`` only mode.
262+
is always used. If ``img`` is Tensor, the flag is False by default and can be set to True for
263+
``InterpolationMode.BILINEAR`` only mode. This can help making the output for PIL images and tensors
264+
closer.
263265
264266
.. warning::
265267
There is no autodiff support for ``antialias=True`` option with input ``img`` as Tensor.

0 commit comments

Comments
 (0)