Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions torchvision/transforms/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def _compute_resized_output_size(


def resize(
img: Tensor,
img: Union[PIL.Image.Image, Tensor],
size: list[int],
interpolation: InterpolationMode = InterpolationMode.BILINEAR,
max_size: Optional[int] = None,
Expand Down Expand Up @@ -479,7 +479,7 @@ def resize(
return F_t.resize(img, size=output_size, interpolation=interpolation.value, antialias=antialias)


def pad(img: Tensor, padding: list[int], fill: Union[int, float] = 0, padding_mode: str = "constant") -> Tensor:
def pad(img: Union[PIL.Image.Image, Tensor], padding: list[int], fill: Union[int, float] = 0, padding_mode: str = "constant") -> Tensor:
r"""Pad the given image on all sides with the given "pad" value.
If the image is torch Tensor, it is expected
to have [..., H, W] shape, where ... means at most 2 leading dimensions for mode reflect and symmetric,
Expand Down
4 changes: 2 additions & 2 deletions torchvision/transforms/v2/functional/_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _compute_resized_output_size(


def resize(
inpt: torch.Tensor,
inpt: Union[PIL.Image.Image, torch.Tensor],
size: Optional[list[int]],
interpolation: Union[InterpolationMode, int] = InterpolationMode.BILINEAR,
max_size: Optional[int] = None,
Expand Down Expand Up @@ -1509,7 +1509,7 @@ def rotate_video(


def pad(
inpt: torch.Tensor,
inpt: Union[PIL.Image.Image, torch.Tensor],
padding: list[int],
fill: Optional[Union[int, float, list[float]]] = None,
padding_mode: str = "constant",
Expand Down