LaplaceNoise#
- class deepinv.physics.LaplaceNoise(b=0.1, rng=None)[source]#
Bases:
NoiseModelLaplace noise \(y = z + \epsilon\) where \(\epsilon\sim\text{Laplace}(0,b)\). In the laplace distribution, b is the scale parameter and the variance is given by \(\sigma^2=2b^2\).
- Parameters:
b (Union[float, torch.Generator]) – scale of the noise.
rng (torch.Generator, None) – (optional) a pseudorandom random number generator for the parameter generation.
:Examples:Adding Laplace noise to a physics operator by setting the
noise_modelattribute of the physics operator:>>> from deepinv.physics import Denoising, LaplaceNoise >>> import torch >>> physics = Denoising() >>> physics.noise_model = LaplaceNoise() >>> x = torch.rand(1, 1, 2, 2) >>> y = physics(x)
- forward(x, b=None, seed=None, **kwargs)[source]#
Adds the noise to measurements x
- Parameters:
x (torch.Tensor) – measurements
b (float, torch.Tensor) – scale of the noise. If not None, it will overwrite the current noise level.
seed (int) – the seed for the random number generator, if
rngis provided.
- Returns:
noisy measurements