EulerSolver#

class deepinv.sampling.EulerSolver(timesteps=None, t_start=None, t_end=None, num_steps=None, rng=None)[source]#

Bases: BaseSDESolver

Euler-Maruyama solver for SDEs.

This solver uses the Euler-Maruyama method to numerically integrate SDEs. It is a first-order method that approximates the solution using the following update rule:

\[x_{t+dt} = x_t + f(x_t,t)dt + g(t) W_{dt}\]

where \(W_t\) is a Gaussian random variable with mean 0 and variance dt.

Parameters:
  • timesteps (torch.Tensor, numpy.ndarray, list) – The time steps at which to evaluate the solution.

  • timesteps – 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.

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

Note

You can either provide the timesteps argument directly, or specify t_start, t_end, and num_steps to generate the time steps automatically (linearly with constant stepsize). If both are provided, the timesteps argument will take precedence.

Examples using EulerSolver:#

Using state-of-the-art diffusion models from HuggingFace Diffusers with DeepInverse

Using state-of-the-art diffusion models from HuggingFace Diffusers with DeepInverse

Building your diffusion posterior sampling method using SDEs

Building your diffusion posterior sampling method using SDEs

Flow-Matching for posterior sampling and unconditional generation

Flow-Matching for posterior sampling and unconditional generation