DDPMSolver#
- class deepinv.sampling.DDPMSolver(timesteps=None, t_start=None, t_end=None, num_steps=None, variance='small', rng=None)[source]#
Bases:
AncestralSolverDDPM solver for reverse-time diffusion SDEs.
Ancestral sampler of DDPM [1], i.e.
deepinv.sampling.AncestralSolverwith \(\eta = 1\) and the stochastic termalphaof the SDE is ignored (fixed to 1).For
deepinv.sampling.VariancePreservingDiffusionwith 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\). Withvariance="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] anddeepinv.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
timestepsargument.t_end (float) – the ending time of the SDE, optional. If not provided, it will be inferred from the
timestepsargument.num_steps (int) – the number of time steps for the SDE, optional. If not provided, it will be inferred from the
timestepsargument.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: