From d87d3abfe4b9ff27c642fd91c6899cccf6ef876a Mon Sep 17 00:00:00 2001 From: Nicolas Hug Date: Thu, 16 Feb 2023 16:48:45 +0000 Subject: [PATCH] Make rotate_image_tensor's results fully BC with v1 --- torchvision/transforms/v2/functional/_geometry.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/torchvision/transforms/v2/functional/_geometry.py b/torchvision/transforms/v2/functional/_geometry.py index baa2f24f21a..1ffd7f45452 100644 --- a/torchvision/transforms/v2/functional/_geometry.py +++ b/torchvision/transforms/v2/functional/_geometry.py @@ -832,10 +832,10 @@ def rotate_image_tensor( center_f = [0.0, 0.0] if center is not None: if expand: + # TODO: Do we actually want to warn, or just document this? warnings.warn("The provided center argument has no effect on the result if expand is True") - else: - # Center values should be in pixel coordinates but translated such that (0, 0) corresponds to image center. - center_f = [(c - s * 0.5) for c, s in zip(center, [width, height])] + # Center values should be in pixel coordinates but translated such that (0, 0) corresponds to image center. + center_f = [(c - s * 0.5) for c, s in zip(center, [width, height])] # due to current incoherence of rotation angle direction between affine and rotate implementations # we need to set -angle.