DDPM needs about a thousand network evaluations per image. DDIM observes that the training objective does not depend on the forward process being Markov, which allows a family of samplers that are deterministic and can skip steps. A DDIM step first uses the noise prediction to estimate the clean image, x0_hat, and then re-noises that estimate to the target noise level t_prev with the same predicted noise: x_prev = sqrt(ab_prev) * x0_hat + sqrt(1 - ab_prev) * eps_pred. With t_prev far from t, a few dozen steps replace a thousand, and because no fresh noise is injected the same starting noise always gives the same image.
Implement ddim_step.
ddim_step(x_t, eps_pred, t, t_prev, alpha_bars): t and t_prev are 0-based indices into alpha_bars with t_prev < t; t_prev = -1 means the fully clean level ab_prev = 1.ab = alpha_bars[t], x0_hat = (x_t - sqrt(1 - ab) * eps_pred) / sqrt(ab), then return sqrt(ab_prev) * x0_hat + sqrt(1 - ab_prev) * eps_pred.eta = 0 (deterministic) DDIM update.When t_prev = -1, ab_prev = 1 so the result is exactly x0_hat.
If eps_pred is the true noise, the result equals the forward-process sample at t_prev built from the same noise.
No results yet
Run your code to check it against the examples, or submit to run every test.