#9652·vision

Support PIL images in v2.GaussianNoise

Author: YeonwooSungCreated Sep 5, 2026Updated Sep 5, 2026

Description

torchvision.transforms.v2.functional.gaussian_noise (and thus v2.GaussianNoise) currently stubs out PIL images:

python
raise ValueError("Gaussian Noise is not implemented for PIL images.")

The tensor kernels already support uint8 and float inputs. We should implement the PIL kernel the same way as gaussian_blur: convert with pil_to_tensor, run the existing image kernel, then convert back with to_pil_image.

Proposed change

  • Register a PIL kernel for gaussian_noise that reuses gaussian_noise_image.
  • Document that PIL images are supported (uint8 path via pil_to_tensor).
  • Replace the current negative PIL test with a positive one.