pytorch / pytorch/vision

Support PIL images in v2.GaussianNoise

Open Beginner friendly
#9,652 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
17.9k
Forks
7.3k
Avg merge
1d 15h
Merged PRs (30d)
13

Description

Description

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

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at torchvision.transforms.v2.functional.gaussian_noise and compare its PIL handling with gaussian_blur, including the existing gaussian_noise_image kernel. Replace the negative PIL test with a positive case, document PIL support, and confirm the kernel converts through pil_to_tensor and to_pil_image while preserving the expected noise behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.