Skip to content

Commit 005a424

Browse files
committed
Better types
1 parent 044eacd commit 005a424

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

torchvision/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88

99
import numpy as np
1010
import torch
11-
from PIL import __version__ as PILLOW_VERSION, Image, ImageColor, ImageDraw, ImageFont
11+
from PIL import __version__ as PILLOW_VERSION_STRING, Image, ImageColor, ImageDraw, ImageFont
1212

13-
PILLOW_VERSION = tuple(int(x) for x in PILLOW_VERSION.split("."))
13+
PILLOW_VERSION = tuple(int(x) for x in PILLOW_VERSION_STRING.split("."))
1414

1515
__all__ = [
1616
"_Image_fromarray",
@@ -177,9 +177,9 @@ def dashed_line(self, xy, fill=None, width=0, joint=None, dash_length=5, space_l
177177

178178

179179
def _Image_fromarray(
180-
obj: Union[torch.Tensor, np.ndarray],
180+
obj: np.ndarray,
181181
mode: Optional[str],
182-
) -> Image:
182+
) -> Image.Image:
183183
"""
184184
A wrapper around PIL.Image.fromarray to mitigate the deprecation of the
185185
mode paramter. See:

0 commit comments

Comments
 (0)