@@ -20,7 +20,7 @@
Loading
20 20
from . import functional_tensor as F_t
21 21
22 22
23 -
class InterpolationModes(Enum):
23 +
class InterpolationMode(Enum):
24 24
    """Interpolation modes
25 25
    """
26 26
    NEAREST = "nearest"
@@ -33,26 +33,26 @@
Loading
33 33
34 34
35 35
# TODO: Once torchscript supports Enums with staticmethod
36 -
# this can be put into InterpolationModes as staticmethod
37 -
def _interpolation_modes_from_int(i: int) -> InterpolationModes:
36 +
# this can be put into InterpolationMode as staticmethod
37 +
def _interpolation_modes_from_int(i: int) -> InterpolationMode:
38 38
    inverse_modes_mapping = {
39 -
        0: InterpolationModes.NEAREST,
40 -
        2: InterpolationModes.BILINEAR,
41 -
        3: InterpolationModes.BICUBIC,
42 -
        4: InterpolationModes.BOX,
43 -
        5: InterpolationModes.HAMMING,
44 -
        1: InterpolationModes.LANCZOS,
39 +
        0: InterpolationMode.NEAREST,
40 +
        2: InterpolationMode.BILINEAR,
41 +
        3: InterpolationMode.BICUBIC,
42 +
        4: InterpolationMode.BOX,
43 +
        5: InterpolationMode.HAMMING,
44 +
        1: InterpolationMode.LANCZOS,
45 45
    }
46 46
    return inverse_modes_mapping[i]
47 47
48 48
49 49
pil_modes_mapping = {
50 -
    InterpolationModes.NEAREST: 0,
51 -
    InterpolationModes.BILINEAR: 2,
52 -
    InterpolationModes.BICUBIC: 3,
53 -
    InterpolationModes.BOX: 4,
54 -
    InterpolationModes.HAMMING: 5,
55 -
    InterpolationModes.LANCZOS: 1,
50 +
    InterpolationMode.NEAREST: 0,
51 +
    InterpolationMode.BILINEAR: 2,
52 +
    InterpolationMode.BICUBIC: 3,
53 +
    InterpolationMode.BOX: 4,
54 +
    InterpolationMode.HAMMING: 5,
55 +
    InterpolationMode.LANCZOS: 1,
56 56
}
57 57
58 58
_is_pil_image = F_pil._is_pil_image
@@ -329,7 +329,7 @@
Loading
329 329
    return tensor
330 330
331 331
332 -
def resize(img: Tensor, size: List[int], interpolation: InterpolationModes = InterpolationModes.BILINEAR) -> Tensor:
332 +
def resize(img: Tensor, size: List[int], interpolation: InterpolationMode = InterpolationMode.BILINEAR) -> Tensor:
333 333
    r"""Resize the input image to the given size.
334 334
    The image can be a PIL Image or a torch Tensor, in which case it is expected
335 335
    to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions
@@ -343,10 +343,10 @@
Loading
343 343
            :math:`\left(\text{size} \times \frac{\text{height}}{\text{width}}, \text{size}\right)`.
344 344
            In torchscript mode size as single int is not supported, use a tuple or
345 345
            list of length 1: ``[size, ]``.
346 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
347 -
            :class:`torchvision.transforms.InterpolationModes`.
348 -
            Default is ``InterpolationModes.BILINEAR``. If input is Tensor, only ``InterpolationModes.NEAREST``,
349 -
            ``InterpolationModes.BILINEAR`` and ``InterpolationModes.BICUBIC`` are supported.
346 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
347 +
            :class:`torchvision.transforms.InterpolationMode`.
348 +
            Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``,
349 +
            ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` are supported.
350 350
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
351 351
352 352
    Returns:
@@ -355,13 +355,13 @@
Loading
355 355
    # Backward compatibility with integer value
356 356
    if isinstance(interpolation, int):
357 357
        warnings.warn(
358 -
            "Argument interpolation should be of type InterpolationModes instead of int. "
359 -
            "Please, use InterpolationModes enum."
358 +
            "Argument interpolation should be of type InterpolationMode instead of int. "
359 +
            "Please, use InterpolationMode enum."
360 360
        )
361 361
        interpolation = _interpolation_modes_from_int(interpolation)
362 362
363 -
    if not isinstance(interpolation, InterpolationModes):
364 -
        raise TypeError("Argument interpolation should be a InterpolationModes")
363 +
    if not isinstance(interpolation, InterpolationMode):
364 +
        raise TypeError("Argument interpolation should be a InterpolationMode")
365 365
366 366
    if not isinstance(img, torch.Tensor):
367 367
        pil_interpolation = pil_modes_mapping[interpolation]
@@ -475,7 +475,7 @@
Loading
475 475
476 476
def resized_crop(
477 477
        img: Tensor, top: int, left: int, height: int, width: int, size: List[int],
478 -
        interpolation: InterpolationModes = InterpolationModes.BILINEAR
478 +
        interpolation: InterpolationMode = InterpolationMode.BILINEAR
479 479
) -> Tensor:
480 480
    """Crop the given image and resize it to desired size.
481 481
    The image can be a PIL Image or a Tensor, in which case it is expected
@@ -490,10 +490,10 @@
Loading
490 490
        height (int): Height of the crop box.
491 491
        width (int): Width of the crop box.
492 492
        size (sequence or int): Desired output size. Same semantics as ``resize``.
493 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
494 -
            :class:`torchvision.transforms.InterpolationModes`.
495 -
            Default is ``InterpolationModes.BILINEAR``. If input is Tensor, only ``InterpolationModes.NEAREST``,
496 -
            ``InterpolationModes.BILINEAR`` and ``InterpolationModes.BICUBIC`` are supported.
493 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
494 +
            :class:`torchvision.transforms.InterpolationMode`.
495 +
            Default is ``InterpolationMode.BILINEAR``. If input is Tensor, only ``InterpolationMode.NEAREST``,
496 +
            ``InterpolationMode.BILINEAR`` and ``InterpolationMode.BICUBIC`` are supported.
497 497
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
498 498
499 499
    Returns:
@@ -556,7 +556,7 @@
Loading
556 556
        img: Tensor,
557 557
        startpoints: List[List[int]],
558 558
        endpoints: List[List[int]],
559 -
        interpolation: InterpolationModes = InterpolationModes.BILINEAR,
559 +
        interpolation: InterpolationMode = InterpolationMode.BILINEAR,
560 560
        fill: Optional[int] = None
561 561
) -> Tensor:
562 562
    """Perform perspective transform of the given image.
@@ -569,9 +569,9 @@
Loading
569 569
            ``[top-left, top-right, bottom-right, bottom-left]`` of the original image.
570 570
        endpoints (list of list of ints): List containing four lists of two integers corresponding to four corners
571 571
            ``[top-left, top-right, bottom-right, bottom-left]`` of the transformed image.
572 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
573 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.BILINEAR``.
574 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` are supported.
572 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
573 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
574 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
575 575
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
576 576
        fill (n-tuple or int or float): Pixel fill value for area outside the rotated
577 577
            image. If int or float, the value is used for all bands respectively.
@@ -587,13 +587,13 @@
Loading
587 587
    # Backward compatibility with integer value
588 588
    if isinstance(interpolation, int):
589 589
        warnings.warn(
590 -
            "Argument interpolation should be of type InterpolationModes instead of int. "
591 -
            "Please, use InterpolationModes enum."
590 +
            "Argument interpolation should be of type InterpolationMode instead of int. "
591 +
            "Please, use InterpolationMode enum."
592 592
        )
593 593
        interpolation = _interpolation_modes_from_int(interpolation)
594 594
595 -
    if not isinstance(interpolation, InterpolationModes):
596 -
        raise TypeError("Argument interpolation should be a InterpolationModes")
595 +
    if not isinstance(interpolation, InterpolationMode):
596 +
        raise TypeError("Argument interpolation should be a InterpolationMode")
597 597
598 598
    if not isinstance(img, torch.Tensor):
599 599
        pil_interpolation = pil_modes_mapping[interpolation]
@@ -869,7 +869,7 @@
Loading
869 869
870 870
871 871
def rotate(
872 -
        img: Tensor, angle: float, interpolation: InterpolationModes = InterpolationModes.NEAREST,
872 +
        img: Tensor, angle: float, interpolation: InterpolationMode = InterpolationMode.NEAREST,
873 873
        expand: bool = False, center: Optional[List[int]] = None,
874 874
        fill: Optional[int] = None, resample: Optional[int] = None
875 875
) -> Tensor:
@@ -880,9 +880,9 @@
Loading
880 880
    Args:
881 881
        img (PIL Image or Tensor): image to be rotated.
882 882
        angle (float or int): rotation angle value in degrees, counter-clockwise.
883 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
884 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.NEAREST``.
885 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` are supported.
883 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
884 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
885 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
886 886
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
887 887
        expand (bool, optional): Optional expansion flag.
888 888
            If true, expands the output image to make it large enough to hold the entire rotated image.
@@ -913,8 +913,8 @@
Loading
913 913
    # Backward compatibility with integer value
914 914
    if isinstance(interpolation, int):
915 915
        warnings.warn(
916 -
            "Argument interpolation should be of type InterpolationModes instead of int. "
917 -
            "Please, use InterpolationModes enum."
916 +
            "Argument interpolation should be of type InterpolationMode instead of int. "
917 +
            "Please, use InterpolationMode enum."
918 918
        )
919 919
        interpolation = _interpolation_modes_from_int(interpolation)
920 920
@@ -924,8 +924,8 @@
Loading
924 924
    if center is not None and not isinstance(center, (list, tuple)):
925 925
        raise TypeError("Argument center should be a sequence")
926 926
927 -
    if not isinstance(interpolation, InterpolationModes):
928 -
        raise TypeError("Argument interpolation should be a InterpolationModes")
927 +
    if not isinstance(interpolation, InterpolationMode):
928 +
        raise TypeError("Argument interpolation should be a InterpolationMode")
929 929
930 930
    if not isinstance(img, torch.Tensor):
931 931
        pil_interpolation = pil_modes_mapping[interpolation]
@@ -945,7 +945,7 @@
Loading
945 945
946 946
def affine(
947 947
        img: Tensor, angle: float, translate: List[int], scale: float, shear: List[float],
948 -
        interpolation: InterpolationModes = InterpolationModes.NEAREST, fill: Optional[int] = None,
948 +
        interpolation: InterpolationMode = InterpolationMode.NEAREST, fill: Optional[int] = None,
949 949
        resample: Optional[int] = None, fillcolor: Optional[int] = None
950 950
) -> Tensor:
951 951
    """Apply affine transformation on the image keeping image center invariant.
@@ -960,9 +960,9 @@
Loading
960 960
        shear (float or tuple or list): shear angle value in degrees between -180 to 180, clockwise direction.
961 961
            If a tuple of list is specified, the first value corresponds to a shear parallel to the x axis, while
962 962
            the second value corresponds to a shear parallel to the y axis.
963 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
964 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.NEAREST``.
965 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` are supported.
963 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
964 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
965 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
966 966
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
967 967
        fill (int): Optional fill color for the area outside the transform in the output image (Pillow>=5.0.0).
968 968
            This option is not supported for Tensor input. Fill value for the area outside the transform in the output
@@ -984,8 +984,8 @@
Loading
984 984
    # Backward compatibility with integer value
985 985
    if isinstance(interpolation, int):
986 986
        warnings.warn(
987 -
            "Argument interpolation should be of type InterpolationModes instead of int. "
988 -
            "Please, use InterpolationModes enum."
987 +
            "Argument interpolation should be of type InterpolationMode instead of int. "
988 +
            "Please, use InterpolationMode enum."
989 989
        )
990 990
        interpolation = _interpolation_modes_from_int(interpolation)
991 991
@@ -1010,8 +1010,8 @@
Loading
1010 1010
    if not isinstance(shear, (numbers.Number, (list, tuple))):
1011 1011
        raise TypeError("Shear should be either a single value or a sequence of two values")
1012 1012
1013 -
    if not isinstance(interpolation, InterpolationModes):
1014 -
        raise TypeError("Argument interpolation should be a InterpolationModes")
1013 +
    if not isinstance(interpolation, InterpolationMode):
1014 +
        raise TypeError("Argument interpolation should be a InterpolationMode")
1015 1015
1016 1016
    if isinstance(angle, int):
1017 1017
        angle = float(angle)

@@ -14,14 +14,14 @@
Loading
14 14
    accimage = None
15 15
16 16
from . import functional as F
17 -
from .functional import InterpolationModes, _interpolation_modes_from_int
17 +
from .functional import InterpolationMode, _interpolation_modes_from_int
18 18
19 19
20 20
__all__ = ["Compose", "ToTensor", "PILToTensor", "ConvertImageDtype", "ToPILImage", "Normalize", "Resize", "Scale",
21 21
           "CenterCrop", "Pad", "Lambda", "RandomApply", "RandomChoice", "RandomOrder", "RandomCrop",
22 22
           "RandomHorizontalFlip", "RandomVerticalFlip", "RandomResizedCrop", "RandomSizedCrop", "FiveCrop", "TenCrop",
23 23
           "LinearTransformation", "ColorJitter", "RandomRotation", "RandomAffine", "Grayscale", "RandomGrayscale",
24 -
           "RandomPerspective", "RandomErasing", "GaussianBlur", "InterpolationModes"]
24 +
           "RandomPerspective", "RandomErasing", "GaussianBlur", "InterpolationMode"]
25 25
26 26
27 27
class Compose:
@@ -234,15 +234,15 @@
Loading
234 234
            (size * height / width, size).
235 235
            In torchscript mode padding as single int is not supported, use a tuple or
236 236
            list of length 1: ``[size, ]``.
237 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
238 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.BILINEAR``.
239 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` and
240 -
            ``InterpolationModes.BICUBIC`` are supported.
237 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
238 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
239 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` and
240 +
            ``InterpolationMode.BICUBIC`` are supported.
241 241
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
242 242
243 243
    """
244 244
245 -
    def __init__(self, size, interpolation=InterpolationModes.BILINEAR):
245 +
    def __init__(self, size, interpolation=InterpolationMode.BILINEAR):
246 246
        super().__init__()
247 247
        if not isinstance(size, (int, Sequence)):
248 248
            raise TypeError("Size should be int or sequence. Got {}".format(type(size)))
@@ -253,8 +253,8 @@
Loading
253 253
        # Backward compatibility with integer value
254 254
        if isinstance(interpolation, int):
255 255
            warnings.warn(
256 -
                "Argument interpolation should be of type InterpolationModes instead of int. "
257 -
                "Please, use InterpolationModes enum."
256 +
                "Argument interpolation should be of type InterpolationMode instead of int. "
257 +
                "Please, use InterpolationMode enum."
258 258
            )
259 259
            interpolation = _interpolation_modes_from_int(interpolation)
260 260
@@ -663,9 +663,9 @@
Loading
663 663
        distortion_scale (float): argument to control the degree of distortion and ranges from 0 to 1.
664 664
            Default is 0.5.
665 665
        p (float): probability of the image being transformed. Default is 0.5.
666 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
667 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.BILINEAR``.
668 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` are supported.
666 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
667 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
668 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
669 669
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
670 670
        fill (n-tuple or int or float): Pixel fill value for area outside the rotated
671 671
            image. If int or float, the value is used for all bands respectively. Default is 0.
@@ -673,15 +673,15 @@
Loading
673 673
            input. Fill value for the area outside the transform in the output image is always 0.
674 674
    """
675 675
676 -
    def __init__(self, distortion_scale=0.5, p=0.5, interpolation=InterpolationModes.BILINEAR, fill=0):
676 +
    def __init__(self, distortion_scale=0.5, p=0.5, interpolation=InterpolationMode.BILINEAR, fill=0):
677 677
        super().__init__()
678 678
        self.p = p
679 679
680 680
        # Backward compatibility with integer value
681 681
        if isinstance(interpolation, int):
682 682
            warnings.warn(
683 -
                "Argument interpolation should be of type InterpolationModes instead of int. "
684 -
                "Please, use InterpolationModes enum."
683 +
                "Argument interpolation should be of type InterpolationMode instead of int. "
684 +
                "Please, use InterpolationMode enum."
685 685
            )
686 686
            interpolation = _interpolation_modes_from_int(interpolation)
687 687
@@ -758,15 +758,15 @@
Loading
758 758
            made. If provided a tuple or list of length 1, it will be interpreted as (size[0], size[0]).
759 759
        scale (tuple of float): scale range of the cropped image before resizing, relatively to the origin image.
760 760
        ratio (tuple of float): aspect ratio range of the cropped image before resizing.
761 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
762 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.BILINEAR``.
763 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` and
764 -
            ``InterpolationModes.BICUBIC`` are supported.
761 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
762 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
763 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` and
764 +
            ``InterpolationMode.BICUBIC`` are supported.
765 765
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
766 766
767 767
    """
768 768
769 -
    def __init__(self, size, scale=(0.08, 1.0), ratio=(3. / 4., 4. / 3.), interpolation=InterpolationModes.BILINEAR):
769 +
    def __init__(self, size, scale=(0.08, 1.0), ratio=(3. / 4., 4. / 3.), interpolation=InterpolationMode.BILINEAR):
770 770
        super().__init__()
771 771
        self.size = _setup_size(size, error_msg="Please provide only two dimensions (h, w) for size.")
772 772
@@ -780,8 +780,8 @@
Loading
780 780
        # Backward compatibility with integer value
781 781
        if isinstance(interpolation, int):
782 782
            warnings.warn(
783 -
                "Argument interpolation should be of type InterpolationModes instead of int. "
784 -
                "Please, use InterpolationModes enum."
783 +
                "Argument interpolation should be of type InterpolationMode instead of int. "
784 +
                "Please, use InterpolationMode enum."
785 785
            )
786 786
            interpolation = _interpolation_modes_from_int(interpolation)
787 787
@@ -1147,9 +1147,9 @@
Loading
1147 1147
        degrees (sequence or float or int): Range of degrees to select from.
1148 1148
            If degrees is a number instead of sequence like (min, max), the range of degrees
1149 1149
            will be (-degrees, +degrees).
1150 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
1151 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.NEAREST``.
1152 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` are supported.
1150 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
1151 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
1152 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
1153 1153
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
1154 1154
        expand (bool, optional): Optional expansion flag.
1155 1155
            If true, expands the output to make it large enough to hold the entire rotated image.
@@ -1170,7 +1170,7 @@
Loading
1170 1170
    """
1171 1171
1172 1172
    def __init__(
1173 -
        self, degrees, interpolation=InterpolationModes.NEAREST, expand=False, center=None, fill=None, resample=None
1173 +
        self, degrees, interpolation=InterpolationMode.NEAREST, expand=False, center=None, fill=None, resample=None
1174 1174
    ):
1175 1175
        super().__init__()
1176 1176
        if resample is not None:
@@ -1182,8 +1182,8 @@
Loading
1182 1182
        # Backward compatibility with integer value
1183 1183
        if isinstance(interpolation, int):
1184 1184
            warnings.warn(
1185 -
                "Argument interpolation should be of type InterpolationModes instead of int. "
1186 -
                "Please, use InterpolationModes enum."
1185 +
                "Argument interpolation should be of type InterpolationMode instead of int. "
1186 +
                "Please, use InterpolationMode enum."
1187 1187
            )
1188 1188
            interpolation = _interpolation_modes_from_int(interpolation)
1189 1189
@@ -1253,9 +1253,9 @@
Loading
1253 1253
            range (shear[0], shear[1]) will be applied. Else if shear is a tuple or list of 4 values,
1254 1254
            a x-axis shear in (shear[0], shear[1]) and y-axis shear in (shear[2], shear[3]) will be applied.
1255 1255
            Will not apply shear by default.
1256 -
        interpolation (InterpolationModes): Desired interpolation enum defined by
1257 -
            :class:`torchvision.transforms.InterpolationModes`. Default is ``InterpolationModes.NEAREST``.
1258 -
            If input is Tensor, only ``InterpolationModes.NEAREST``, ``InterpolationModes.BILINEAR`` are supported.
1256 +
        interpolation (InterpolationMode): Desired interpolation enum defined by
1257 +
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
1258 +
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
1259 1259
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
1260 1260
        fill (tuple or int): Optional fill color (Tuple for RGB Image and int for grayscale) for the area
1261 1261
            outside the transform in the output image (Pillow>=5.0.0). This option is not supported for Tensor
@@ -1270,7 +1270,7 @@
Loading
1270 1270
    """
1271 1271
1272 1272
    def __init__(
1273 -
        self, degrees, translate=None, scale=None, shear=None, interpolation=InterpolationModes.NEAREST, fill=0,
1273 +
        self, degrees, translate=None, scale=None, shear=None, interpolation=InterpolationMode.NEAREST, fill=0,
1274 1274
        fillcolor=None, resample=None
1275 1275
    ):
1276 1276
        super().__init__()
@@ -1283,8 +1283,8 @@
Loading
1283 1283
        # Backward compatibility with integer value
1284 1284
        if isinstance(interpolation, int):
1285 1285
            warnings.warn(
1286 -
                "Argument interpolation should be of type InterpolationModes instead of int. "
1287 -
                "Please, use InterpolationModes enum."
1286 +
                "Argument interpolation should be of type InterpolationMode instead of int. "
1287 +
                "Please, use InterpolationMode enum."
1288 1288
            )
1289 1289
            interpolation = _interpolation_modes_from_int(interpolation)
1290 1290
@@ -1377,7 +1377,7 @@
Loading
1377 1377
            s += ', scale={scale}'
1378 1378
        if self.shear is not None:
1379 1379
            s += ', shear={shear}'
1380 -
        if self.interpolation != InterpolationModes.NEAREST:
1380 +
        if self.interpolation != InterpolationMode.NEAREST:
1381 1381
            s += ', interpolation={interpolation}'
1382 1382
        if self.fill != 0:
1383 1383
            s += ', fill={fill}'
Files Coverage
torchvision 72.35%
Project Totals (99 files) 72.35%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading