From 0043e5fd6dacc2031bfefbc01da1bf5ba3aef50b Mon Sep 17 00:00:00 2001 From: SHU Date: Thu, 9 May 2019 21:14:48 +0900 Subject: [PATCH] Minor fix evaluation formula of PILLOW_VERSION Enable fillcolor option for affine transformation for Pillow >= 5.0.0 as described --- torchvision/transforms/functional.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/transforms/functional.py b/torchvision/transforms/functional.py index 2d1ab401a39..be2a94abab7 100644 --- a/torchvision/transforms/functional.py +++ b/torchvision/transforms/functional.py @@ -766,7 +766,7 @@ def affine(img, angle, translate, scale, shear, resample=0, fillcolor=None): output_size = img.size center = (img.size[0] * 0.5 + 0.5, img.size[1] * 0.5 + 0.5) matrix = _get_inverse_affine_matrix(center, angle, translate, scale, shear) - kwargs = {"fillcolor": fillcolor} if PILLOW_VERSION[0] == '5' else {} + kwargs = {"fillcolor": fillcolor} if PILLOW_VERSION[0] >= '5' else {} return img.transform(output_size, Image.AFFINE, matrix, resample, **kwargs)