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:

transform(inpt: Any, params: Dict[str, Any]) → Any[source]

Method to override for custom transforms.

See How to write your own v2 transforms