GaussianNoise — Torchvision 0.22 documentation (original) (raw)
class torchvision.transforms.v2.GaussianNoise(mean: float = 0.0, sigma: float = 0.1, clip=True)[source]¶
Add gaussian noise to images or videos.
The input tensor is expected to be in […, 1 or 3, H, W] format, where … means it can have an arbitrary number of leading dimensions. Each image or frame in a batch will be transformed independently i.e. the noise added to each image will be different.
The input tensor is also expected to be of float dtype in [0, 1]
. This transform does not support PIL images.
Parameters:
- mean (float) – Mean of the sampled normal distribution. Default is 0.
- sigma (float) – Standard deviation of the sampled normal distribution. Default is 0.1.
- clip (bool, optional) – Whether to clip the values in
[0, 1]
after adding noise. Default is True.
transform(inpt: Any, params: Dict[str, Any]) → Any[source]¶
Method to override for custom transforms.