Skip to content

Commit 17da55f

Browse files
authored
Apply suggestion from @NicolasHug
1 parent 9df3cd3 commit 17da55f

File tree

1 file changed

+1
-0
lines changed
  • torchvision/transforms/v2/functional

1 file changed

+1
-0
lines changed

torchvision/transforms/v2/functional/_misc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def gaussian_noise_image(image: torch.Tensor, mean: float = 0.0, sigma: float =
207207

208208
elif image.dtype == torch.uint8:
209209
# Convert to intermediate dtype int16 to add to input more efficiently
210+
# See https://github.com/pytorch/vision/pull/9169 for alternative implementations and benchmark
210211
noise = ((mean * 255) + torch.randn_like(image, dtype=torch.float32) * (sigma * 255)).to(torch.int16)
211212
out = image + noise
212213

0 commit comments

Comments
 (0)