(img: Tensor,
           angle: float,
           interpolation: InterpolationMode=InterpolationMode.NEAREST,
           expand: bool=False,
           center: Optional[List[int]]=None,
           fill: Optional[List[float]]=None,
           resample: Optional[int]=None)
return F_t.rotate(
        img,
        matrix=matrix,
        interpolation=interpolation.value,
        expand=expand,
        fill=fill)
Rotate the image by angle.
    If the image is torch Tensor, it is expected
    to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions.

    Args:
        img (PIL Image or Tensor): image to be rotated.
        angle (number): rotation angle value in degrees, counter-clockwise.
        interpolation (InterpolationMode): Desired interpolation enum defined by
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
        expand (bool, optional): Optional expansion flag.
            If true, expands the output image 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.
        center (sequence, optional): Optional center of rotation. Origin is the upper left corner.
            Default is the center of the image.
        fill (sequence or number, optional): Pixel fill value for the area outside the transformed
            image. If given a number, the value is used for all bands respectively.

            .. note::
                In torchscript mode single int/float value is not supported, please use a sequence
                of length 1: ``[value, ]``.

    Returns:
        PIL Image or Tensor: Rotated image.

    .. _filters: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#filters
Rotate the image by angle.
    If the image is torch Tensor, it is expected
    to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions.
Rotate the image by angle . If the image is torch Tensor it is expected to have [ ... H W ] shape where ... means an arbitrary number of leading dimensions .
def rotate(img: Tensor,
           angle: float,
           interpolation: InterpolationMode=InterpolationMode.NEAREST,
           expand: bool=False,
           center: Optional[List[int]]=None,
           fill: Optional[List[float]]=None,
           resample: Optional[int]=None) -> Tensor:
    """Rotate the image by angle.
    If the image is torch Tensor, it is expected
    to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions.

    Args:
        img (PIL Image or Tensor): image to be rotated.
        angle (number): rotation angle value in degrees, counter-clockwise.
        interpolation (InterpolationMode): Desired interpolation enum defined by
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.NEAREST``.
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
        expand (bool, optional): Optional expansion flag.
            If true, expands the output image 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.
        center (sequence, optional): Optional center of rotation. Origin is the upper left corner.
            Default is the center of the image.
        fill (sequence or number, optional): Pixel fill value for the area outside the transformed
            image. If given a number, the value is used for all bands respectively.

            .. note::
                In torchscript mode single int/float value is not supported, please use a sequence
                of length 1: ``[value, ]``.

    Returns:
        PIL Image or Tensor: Rotated image.

    .. _filters: https://pillow.readthedocs.io/en/latest/handbook/concepts.html#filters

    """
    if resample is not None:
        warnings.warn(
            "Argument resample is deprecated and will be removed since v0.10.0. Please, use interpolation instead"
        )
        interpolation = _interpolation_modes_from_int(resample)

    # Backward compatibility with integer value
    if isinstance(interpolation, int):
        warnings.warn(
            "Argument interpolation should be of type InterpolationMode instead of int. "
            "Please, use InterpolationMode enum.")
        interpolation = _interpolation_modes_from_int(interpolation)

    if not isinstance(angle, (int, float)):
        raise TypeError("Argument angle should be int or float")

    if center is not None and not isinstance(center, (list, tuple)):
        raise TypeError("Argument center should be a sequence")

    if not isinstance(interpolation, InterpolationMode):
        raise TypeError("Argument interpolation should be a InterpolationMode")

    if not isinstance(img, torch.Tensor):
        pil_interpolation = pil_modes_mapping[interpolation]
        return F_pil.rotate(
            img,
            angle=angle,
            interpolation=pil_interpolation,
            expand=expand,
            center=center,
            fill=fill)

    center_f = [0.0, 0.0]
    if center is not None:
        img_size = _get_image_size(img)
        # Center values should be in pixel coordinates but translated such that (0, 0) corresponds to image center.
        center_f = [1.0 * (c - s * 0.5) for c, s in zip(center, img_size)]

    # due to current incoherence of rotation angle direction between affine and rotate implementations
    # we need to set -angle.
    matrix = _get_inverse_affine_matrix(center_f, -angle, [0.0, 0.0], 1.0,
                                        [0.0, 0.0])
    return F_t.rotate(
        img,
        matrix=matrix,
        interpolation=interpolation.value,
        expand=expand,
        fill=fill)
def rotate ( img : Tensor , angle : float , interpolation : InterpolationMode = InterpolationMode . NEAREST , expand : bool = False , center : Optional [ List [ int ] ] = None , fill : Optional [ List [ float ] ] = None , resample : Optional [ int ] = None ) -> Tensor : if resample is not None : warnings . warn ( "Argument resample is deprecated and will be removed since v0.10.0. Please, use interpolation instead" ) interpolation = _interpolation_modes_from_int ( resample ) # Backward compatibility with integer value if isinstance ( interpolation , int ) : warnings . warn ( "Argument interpolation should be of type InterpolationMode instead of int. " "Please, use InterpolationMode enum." ) interpolation = _interpolation_modes_from_int ( interpolation ) if not isinstance ( angle , ( int , float ) ) : raise TypeError ( "Argument angle should be int or float" ) if center is not None and not isinstance ( center , ( list , tuple ) ) : raise TypeError ( "Argument center should be a sequence" ) if not isinstance ( interpolation , InterpolationMode ) : raise TypeError ( "Argument interpolation should be a InterpolationMode" ) if not isinstance ( img , torch . Tensor ) : pil_interpolation = pil_modes_mapping [ interpolation ] return F_pil . rotate ( img , angle = angle , interpolation = pil_interpolation , expand = expand , center = center , fill = fill ) center_f = [ 0.0 , 0.0 ] if center is not None : img_size = _get_image_size ( img ) # Center values should be in pixel coordinates but translated such that (0, 0) corresponds to image center. center_f = [ 1.0 * ( c - s * 0.5 ) for c , s in zip ( center , img_size ) ] # due to current incoherence of rotation angle direction between affine and rotate implementations # we need to set -angle. matrix = _get_inverse_affine_matrix ( center_f , - angle , [ 0.0 , 0.0 ] , 1.0 , [ 0.0 , 0.0 ] ) return F_t . rotate ( img , matrix = matrix , interpolation = interpolation . value , expand = expand , fill = fill )