Skip to content

Commit 882eb31

Browse files
committed
Missed function_pil
1 parent 005a424 commit 882eb31

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

torchvision/transforms/_functional_pil.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
from collections.abc import Sequence
33
from typing import Any, Literal, Optional, Union
44

5+
from ..utils import _Image_fromarray
6+
57
import numpy as np
68
import torch
79
from PIL import Image, ImageEnhance, ImageOps
@@ -113,7 +115,7 @@ def adjust_hue(img: Image.Image, hue_factor: float) -> Image.Image:
113115
# This will over/underflow, as desired
114116
np_h += np.int32(hue_factor * 255).astype(np.uint8)
115117

116-
h = Image.fromarray(np_h, "L")
118+
h = _Image_fromarray(np_h, "L")
117119

118120
img = Image.merge("HSV", (h, s, v)).convert(input_mode)
119121
return img
@@ -342,7 +344,7 @@ def to_grayscale(img: Image.Image, num_output_channels: int) -> Image.Image:
342344
img = img.convert("L")
343345
np_img = np.array(img, dtype=np.uint8)
344346
np_img = np.dstack([np_img, np_img, np_img])
345-
img = Image.fromarray(np_img, "RGB")
347+
img = _Image_fromarray(np_img, "RGB")
346348
else:
347349
raise ValueError("num_output_channels should be either 1 or 3")
348350

0 commit comments

Comments
 (0)