DDPMSolver#

class deepinv.sampling.DDPMSolver(timesteps=None, t_start=None, t_end=None, num_steps=None, variance='small', rng=None)[source]#

Bases: AncestralSolver

DDPM solver for reverse-time diffusion SDEs.

Ancestral sampler of DDPM [1], i.e. deepinv.sampling.AncestralSolver with \(\eta = 1\) and the stochastic term alpha of the SDE is ignored (fixed to 1).

For deepinv.sampling.VariancePreservingDiffusion with time steps matching the training time steps of a discrete DDPM model, this is exactly the DDPM sampler with the posterior variance \(\tilde{\beta}_t\). With variance="large", the posterior variance \(\tilde{\beta}_t\) is replaced by the variance \(\beta_t\) of the forward transition, see Section 3.2 of Ho et al.[1] and deepinv.sampling.AncestralSolver.

Parameters:
  • timesteps (torch.Tensor, numpy.ndarray, list) – time steps at which the SDE will be discretized.

  • t_start (float) – the starting time of the SDE, optional. If not provided, it will be inferred from the timesteps argument.

  • t_end (float) – the ending time of the SDE, optional. If not provided, it will be inferred from the timesteps argument.

  • num_steps (int) – the number of time steps for the SDE, optional. If not provided, it will be inferred from the timesteps argument.

  • variance (str) – the variance of the noise added on each step, either "small" (default) for the posterior variance \(\tilde{\beta}_t\), or "large" for the variance \(\beta_t\) of the forward transition.

  • rng (torch.Generator) – A random number generator for reproducibility.


References: