MinusOneOneDenoiserWrapper#

class deepinv.models.MinusOneOneDenoiserWrapper(model, xmin=0.0, xmax=1.0)[source]#

Bases: Module

A wrapper for denoisers trained on \([x_{\mathrm{min}}, x_{\mathrm{max}}]\) images to be used with math:[-1, 1] images, i.e. on diffusion sampling iterates.

Parameters:
  • denoiser (deepinv.models.Denoiser) – the denoiser to be wrapped.

  • xmin (float) – minimum value of the denoiser training range. Default to 0.0.

  • xmax (float) – maximum value of the denoiser training range. Default to 1.0.

forward(x, sigma, *args, **kwargs)[source]#

Apply the wrapped denoiser to the input.

Parameters:
  • x (torch.Tensor) – the input image.

  • sigma (torch.Tensor) – the noise level.

  • args – additional arguments to pass to the denoiser.

  • kwargs – additional keyword arguments passed to the denoiser. If input_in_minus_one_one=True, the input is assumed to be in [-1, 1]; otherwise it is assumed to be in [0, 1] and converted to the denoiser’s training range.

Returns:

the denoised image.

Return type:

torch.Tensor