SigmaGenerator

class deepinv.physics.generator.SigmaGenerator(sigma_min=0.01, sigma_max=0.5, rng: Generator | None = None, device: str = 'cpu', dtype: dtype = torch.float32)[source]

Bases: PhysicsGenerator

Generator for the noise level \(\sigma\) in the Gaussian noise model.

The noise level is sampled uniformly from the interval \([\text{sigma_min}, \text{sigma_max}]\).

Parameters:
  • sigma_min (float) – minimum noise level

  • sigma_max (float) – maximum noise level

  • rng (torch.Generator) – random number generator

  • device (str) – device where the tensor is stored

  • dtype (torch.dtype) – data type of the generated tensor


Examples:

>>> from deepinv.physics.generator import SigmaGenerator
>>> generator = SigmaGenerator()
>>> sigma_dict = generator.step(seed=0) # dict_keys(['sigma'])
>>> print(sigma_dict['sigma'])
tensor([0.2532])
step(batch_size=1, seed: int | None = None, **kwargs)[source]

Generates a batch of noise levels.

Parameters:
  • batch_size (int) – batch size

  • seed (int) – the seed for the random number generator.

Returns:

dictionary with key ‘sigma’: tensor of size (batch_size,).

Return type:

dict