All problems
x0 Prediction From Epsilon
Problem
Recover the clean latent from a noisy sample and the predicted noise: x0 = (x_t - sqrt(1 - alpha_bar_t) * eps) / sqrt(alpha_bar_t).
The signature is x0_from_epsilon(x_t, eps, alpha_bar_t). All values are scalars.
Hint
The x0 estimate is the backbone of DDIM-style deterministic samplers.
Test cases
case 1
in: [1,0,0.5]
expected: 1.4142135624
case 2
in: [0,1,0.25]
expected: -1.7320508076
case 3
in: [2,0.5,0.25]
expected: 3.1339745962
case 4
in: [1,1,1]
expected: 1
Starter codePython
import math
def x0_from_epsilon(x_t, eps, alpha_bar_t):
# Your code here
pass4 test cases · run your code against them in the editor