@@ -297,7 +297,8 @@ class Resize(torch.nn.Module):
297297 :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
298298 If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` and
299299 ``InterpolationMode.BICUBIC`` are supported.
300- For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still acceptable.
300+ For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted,
301+ but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum.
301302 max_size (int, optional): The maximum allowed for the longer edge of
302303 the resized image: if the longer edge of the image is greater
303304 than ``max_size`` after being resized according to ``size``, then
@@ -329,8 +330,8 @@ def __init__(self, size, interpolation=InterpolationMode.BILINEAR, max_size=None
329330 # Backward compatibility with integer value
330331 if isinstance (interpolation , int ):
331332 warnings .warn (
332- "Argument interpolation should be of type InterpolationMode instead of int . "
333- "Please, use InterpolationMode enum."
333+ "Argument ' interpolation' of type int is deprecated since 0.13 and will be removed in 0.15 . "
334+ "Please use InterpolationMode enum."
334335 )
335336 interpolation = _interpolation_modes_from_int (interpolation )
336337
@@ -754,7 +755,8 @@ class RandomPerspective(torch.nn.Module):
754755 interpolation (InterpolationMode): Desired interpolation enum defined by
755756 :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
756757 If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
757- For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still acceptable.
758+ For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted,
759+ but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum.
758760 fill (sequence or number): Pixel fill value for the area outside the transformed
759761 image. Default is ``0``. If given a number, the value is used for all bands respectively.
760762 """
@@ -767,8 +769,8 @@ def __init__(self, distortion_scale=0.5, p=0.5, interpolation=InterpolationMode.
767769 # Backward compatibility with integer value
768770 if isinstance (interpolation , int ):
769771 warnings .warn (
770- "Argument interpolation should be of type InterpolationMode instead of int . "
771- "Please, use InterpolationMode enum."
772+ "Argument ' interpolation' of type int is deprecated since 0.13 and will be removed in 0.15 . "
773+ "Please use InterpolationMode enum."
772774 )
773775 interpolation = _interpolation_modes_from_int (interpolation )
774776
@@ -868,8 +870,8 @@ class RandomResizedCrop(torch.nn.Module):
868870 :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
869871 If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` and
870872 ``InterpolationMode.BICUBIC`` are supported.
871- For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still acceptable.
872-
873+ For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted,
874+ but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum.
873875 """
874876
875877 def __init__ (self , size , scale = (0.08 , 1.0 ), ratio = (3.0 / 4.0 , 4.0 / 3.0 ), interpolation = InterpolationMode .BILINEAR ):
@@ -887,8 +889,8 @@ def __init__(self, size, scale=(0.08, 1.0), ratio=(3.0 / 4.0, 4.0 / 3.0), interp
887889 # Backward compatibility with integer value
888890 if isinstance (interpolation , int ):
889891 warnings .warn (
890- "Argument interpolation should be of type InterpolationMode instead of int . "
891- "Please, use InterpolationMode enum."
892+ "Argument ' interpolation' of type int is deprecated since 0.13 and will be removed in 0.15 . "
893+ "Please use InterpolationMode enum."
892894 )
893895 interpolation = _interpolation_modes_from_int (interpolation )
894896
@@ -1267,7 +1269,8 @@ class RandomRotation(torch.nn.Module):
12671269 interpolation (InterpolationMode): Desired interpolation enum defined by
12681270 :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
12691271 If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
1270- For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still acceptable.
1272+ For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted,
1273+ but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum.
12711274 expand (bool, optional): Optional expansion flag.
12721275 If true, expands the output to make it large enough to hold the entire rotated image.
12731276 If false or omitted, make the output image the same size as the input image.
@@ -1300,8 +1303,8 @@ def __init__(
13001303 # Backward compatibility with integer value
13011304 if isinstance (interpolation , int ):
13021305 warnings .warn (
1303- "Argument interpolation should be of type InterpolationMode instead of int . "
1304- "Please, use InterpolationMode enum."
1306+ "Argument ' interpolation' of type int is deprecated since 0.13 and will be removed in 0.15 . "
1307+ "Please use InterpolationMode enum."
13051308 )
13061309 interpolation = _interpolation_modes_from_int (interpolation )
13071310
@@ -1388,7 +1391,8 @@ class RandomAffine(torch.nn.Module):
13881391 interpolation (InterpolationMode): Desired interpolation enum defined by
13891392 :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
13901393 If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
1391- For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still acceptable.
1394+ For backward compatibility integer values (e.g. ``PIL.Image[.Resampling].NEAREST``) are still accepted,
1395+ but deprecated since 0.13 and will be removed in 0.15. Please use InterpolationMode enum.
13921396 fill (sequence or number): Pixel fill value for the area outside the transformed
13931397 image. Default is ``0``. If given a number, the value is used for all bands respectively.
13941398 fillcolor (sequence or number, optional):
@@ -1429,8 +1433,8 @@ def __init__(
14291433 # Backward compatibility with integer value
14301434 if isinstance (interpolation , int ):
14311435 warnings .warn (
1432- "Argument interpolation should be of type InterpolationMode instead of int . "
1433- "Please, use InterpolationMode enum."
1436+ "Argument ' interpolation' of type int is deprecated since 0.13 and will be removed in 0.15 . "
1437+ "Please use InterpolationMode enum."
14341438 )
14351439 interpolation = _interpolation_modes_from_int (interpolation )
14361440
@@ -1727,9 +1731,7 @@ def forward(self, img):
17271731
17281732 # cast self.value to script acceptable type
17291733 if isinstance (self .value , (int , float )):
1730- value = [
1731- self .value ,
1732- ]
1734+ value = [self .value ]
17331735 elif isinstance (self .value , str ):
17341736 value = None
17351737 elif isinstance (self .value , tuple ):
0 commit comments