GainGenerator#

class deepinv.physics.generator.GainGenerator(gain_min=0.1, gain_max=0.4, rng=None, device='cpu', dtype=torch.float32)[source]#

Bases: PhysicsGenerator

Generator for the noise level \(\gamma\) in the Poisson noise model.

The gain is sampled uniformly from the interval \([\gamma_\text{min}, \gamma_\text{max}]\).

Parameters:
  • gain_min (float) – minimum noise level

  • gain_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 GainGenerator
>>> generator = GainGenerator()
>>> params = generator.step(seed=0) # params(['gain'])
>>> print(params['gain'])
tensor([0.2489])
step(batch_size=1, seed=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 ‘gain’: tensor of size (batch_size,).

Return type:

dict