Skip to content

Commit 63aa0eb

Browse files
authored
Update img parameter type to support PIL images
1 parent ec9cd25 commit 63aa0eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

torchvision/transforms/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def _compute_resized_output_size(
385385

386386

387387
def resize(
388-
img: Tensor,
388+
img: Union[PIL.Image.Image, Tensor],
389389
size: list[int],
390390
interpolation: InterpolationMode = InterpolationMode.BILINEAR,
391391
max_size: Optional[int] = None,
@@ -479,7 +479,7 @@ def resize(
479479
return F_t.resize(img, size=output_size, interpolation=interpolation.value, antialias=antialias)
480480

481481

482-
def pad(img: Tensor, padding: list[int], fill: Union[int, float] = 0, padding_mode: str = "constant") -> Tensor:
482+
def pad(img: Union[PIL.Image.Image, Tensor], padding: list[int], fill: Union[int, float] = 0, padding_mode: str = "constant") -> Tensor:
483483
r"""Pad the given image on all sides with the given "pad" value.
484484
If the image is torch Tensor, it is expected
485485
to have [..., H, W] shape, where ... means at most 2 leading dimensions for mode reflect and symmetric,

0 commit comments

Comments
 (0)