From a1cd97c7b892d5b8ba3875f4e987e148fb76a99c Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Fri, 2 Feb 2024 21:25:41 +0000 Subject: [PATCH] Add parameter type to `to_tensor` --- torchvision/transforms/functional.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torchvision/transforms/functional.py b/torchvision/transforms/functional.py index 698942c56af..4bb5ece8915 100644 --- a/torchvision/transforms/functional.py +++ b/torchvision/transforms/functional.py @@ -123,7 +123,7 @@ def _is_numpy_image(img: Any) -> bool: return img.ndim in {2, 3} -def to_tensor(pic) -> Tensor: +def to_tensor(pic: Union[Image, np.ndarray]) -> Tensor: """Convert a ``PIL Image`` or ``numpy.ndarray`` to tensor. This function does not support torchscript.