See :class:`~torchvision.transforms.v2.RandomPerspective` for details.
(
inpt: torch.Tensor,
startpoints: Optional[list[list[int]]],
endpoints: Optional[list[list[int]]],
interpolation: Union[InterpolationMode, int] = InterpolationMode.BILINEAR,
fill: _FillTypeJIT = None,
coefficients: Optional[list[float]] = None,
)
| 1908 | |
| 1909 | |
| 1910 | def perspective( |
| 1911 | inpt: torch.Tensor, |
| 1912 | startpoints: Optional[list[list[int]]], |
| 1913 | endpoints: Optional[list[list[int]]], |
| 1914 | interpolation: Union[InterpolationMode, int] = InterpolationMode.BILINEAR, |
| 1915 | fill: _FillTypeJIT = None, |
| 1916 | coefficients: Optional[list[float]] = None, |
| 1917 | ) -> torch.Tensor: |
| 1918 | """See :class:`~torchvision.transforms.v2.RandomPerspective` for details.""" |
| 1919 | if torch.jit.is_scripting(): |
| 1920 | return perspective_image( |
| 1921 | inpt, |
| 1922 | startpoints=startpoints, |
| 1923 | endpoints=endpoints, |
| 1924 | interpolation=interpolation, |
| 1925 | fill=fill, |
| 1926 | coefficients=coefficients, |
| 1927 | ) |
| 1928 | |
| 1929 | _log_api_usage_once(perspective) |
| 1930 | |
| 1931 | kernel = _get_kernel(perspective, type(inpt)) |
| 1932 | return kernel( |
| 1933 | inpt, |
| 1934 | startpoints=startpoints, |
| 1935 | endpoints=endpoints, |
| 1936 | interpolation=interpolation, |
| 1937 | fill=fill, |
| 1938 | coefficients=coefficients, |
| 1939 | ) |
| 1940 | |
| 1941 | |
| 1942 | def _perspective_grid(coeffs: list[float], ow: int, oh: int, dtype: torch.dtype, device: torch.device) -> torch.Tensor: |
nothing calls this directly
no test coverage detected
searching dependent graphs…