(img: Tensor,
                startpoints: List[List[int]],
                endpoints: List[List[int]],
                interpolation: InterpolationMode=InterpolationMode.BILINEAR,
                fill: Optional[List[float]]=None)
return F_t.perspective(
        img, coeffs, interpolation=interpolation.value, fill=fill)
Perform perspective transform of the given image.
    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 transformed.
        startpoints (list of list of ints): List containing four lists of two integers corresponding to four corners
            ``[top-left, top-right, bottom-right, bottom-left]`` of the original image.
        endpoints (list of list of ints): List containing four lists of two integers corresponding to four corners
            ``[top-left, top-right, bottom-right, bottom-left]`` of the transformed image.
        interpolation (InterpolationMode): Desired interpolation enum defined by
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
        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: transformed Image.
Perform perspective transform of the given image.
    If the image is torch Tensor, it is expected
    to have [..., H, W] shape, where ... means an arbitrary number of leading dimensions.
Perform perspective transform of the given image . If the image is torch Tensor it is expected to have [ ... H W ] shape where ... means an arbitrary number of leading dimensions .
def perspective(img: Tensor,
                startpoints: List[List[int]],
                endpoints: List[List[int]],
                interpolation: InterpolationMode=InterpolationMode.BILINEAR,
                fill: Optional[List[float]]=None) -> Tensor:
    """Perform perspective transform of the given image.
    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 transformed.
        startpoints (list of list of ints): List containing four lists of two integers corresponding to four corners
            ``[top-left, top-right, bottom-right, bottom-left]`` of the original image.
        endpoints (list of list of ints): List containing four lists of two integers corresponding to four corners
            ``[top-left, top-right, bottom-right, bottom-left]`` of the transformed image.
        interpolation (InterpolationMode): Desired interpolation enum defined by
            :class:`torchvision.transforms.InterpolationMode`. Default is ``InterpolationMode.BILINEAR``.
            If input is Tensor, only ``InterpolationMode.NEAREST``, ``InterpolationMode.BILINEAR`` are supported.
            For backward compatibility integer values (e.g. ``PIL.Image.NEAREST``) are still acceptable.
        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: transformed Image.
    """

    coeffs = _get_perspective_coeffs(startpoints, endpoints)

    # 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(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.perspective(
            img, coeffs, interpolation=pil_interpolation, fill=fill)

    return F_t.perspective(
        img, coeffs, interpolation=interpolation.value, fill=fill)
def perspective ( img : Tensor , startpoints : List [ List [ int ] ] , endpoints : List [ List [ int ] ] , interpolation : InterpolationMode = InterpolationMode . BILINEAR , fill : Optional [ List [ float ] ] = None ) -> Tensor : coeffs = _get_perspective_coeffs ( startpoints , endpoints ) # 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 ( 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 . perspective ( img , coeffs , interpolation = pil_interpolation , fill = fill ) return F_t . perspective ( img , coeffs , interpolation = interpolation . value , fill = fill )