From eb451e3f029c06e04c53759f3daa57d09cdff5bf Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Thu, 31 Aug 2023 16:14:27 +0200 Subject: [PATCH] address comments --- torchvision/transforms/v2/_geometry.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/torchvision/transforms/v2/_geometry.py b/torchvision/transforms/v2/_geometry.py index 76679690c4e..1eb0550e76e 100644 --- a/torchvision/transforms/v2/_geometry.py +++ b/torchvision/transforms/v2/_geometry.py @@ -590,14 +590,16 @@ class RandomRotation(Transform): expand (bool, optional): Optional expansion flag. If true, expands the output to make it large enough to hold the entire rotated image. If false or omitted, make the output image the same size as the input image. - Note that the expand flag assumes rotation around the center and no translation. + Note that the expand flag assumes rotation around the center (see note below) and no translation. center (sequence, optional): Optional center of rotation, (x, y). Origin is the upper left corner. Default is the center of the image. ..note:: - In theory, ``center`` has no effect together with ``expand=True``. In practice however, this can lead to - off-by-one differences of the resulting image size compared to ``center=None``. + In theory, setting ``center`` has no effect if ``expand=True``, since the image center will become the + center of rotation. In practice however, due to numerical precision, this can lead to off-by-one + differences of the resulting image size compared to using the image center in the first place. Thus, when + setting ``expand=True``, it's best to leave ``center=None`` (default). fill (number or tuple or dict, optional): Pixel fill value used when the ``padding_mode`` is constant. Default is 0. If a tuple of length 3, it is used to fill R, G, B channels respectively. Fill value can be also a dictionary mapping data type to the fill value, e.g.