UniformNoise
- class deepinv.physics.UniformNoise(a=0.1, rng: Generator | None = None)[source]
Bases:
NoiseModel
Uniform noise \(y = x + \epsilon\) where \(\epsilon\sim\mathcal{U}(-a,a)\).
- Examples:
Adding uniform noise to a physics operator by setting the
noise_model
attribute of the physics operator:>>> from deepinv.physics import Denoising, UniformNoise >>> import torch >>> physics = Denoising() >>> physics.noise_model = UniformNoise() >>> x = torch.rand(1, 1, 2, 2) >>> y = physics(x)
- Parameters:
a (float) – amplitude of the noise.
rng (torch.Generator (Optional)) – a pseudorandom random number generator for the parameter generation.
- forward(x, a=None, seed: int | None = None, **kwargs)[source]
Adds the noise to measurements x
- Parameters:
x (torch.Tensor) – measurements
a (float, torch.Tensor) – amplitude of the noise. If not None, it will overwrite the current noise level.
seed (int) – the seed for the random number generator, if rng is provided.
- Returns:
noisy measurements
- update_parameters(a=None, **kwargs)[source]
Updates the amplitude of the noise.
- Parameters:
a (float, torch.Tensor) – amplitude of the noise.
Examples using UniformNoise
:
Patch priors for limited-angle computed tomography
Patch priors for limited-angle computed tomography