Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-337

DDPM Noise Target

Problem

Recover the noise that produced x_t from x0 and the cumulative alpha bar.

The DDPM training target is eps = (x_t - sqrt(alpha_bar) * x0) / sqrt(1 - alpha_bar). Return the value rounded to 4 decimal places, or 0.0 when alpha_bar >= 1.

Test cases

case 1
in: [0.5,1,0.9]
expected: -1.4189
case 2
in: [0,0,0.5]
expected: 0
case 3
in: [0.3,0.6,0.25]
expected: 0
case 4
in: [1,1,1]
expected: 0
Starter codePython
def ddpm_noise_target(x_t, x0, alpha_bar):
    # Your code here
    pass

4 test cases · run your code against them in the editor