Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-335

Diffusion Forward Noising

Problem

Apply the closed-form DDPM forward noising step and report the cumulative alpha bar.

The cumulative alpha bar is the product of (1 - beta) over betas, and x_t = sqrt(alpha_bar) * x0 + sqrt(1 - alpha_bar) * noise. Return [round(x_t, 4), round(alpha_bar, 4)].

Test cases

case 1
in: [1,[0.1],0]
expected: [0.9487,0.9]
case 2
in: [1,[0.1],1]
expected: [1.2649,0.9]
case 3
in: [2,[0.01,0.02,0.04],-1]
expected: [1.6682,0.9314]
case 4
in: [0.5,[0.5,0.5],0.5]
expected: [0.683,0.25]
Starter codePython
def diffusion_forward(x0, betas, noise):
    # Your code here
    pass

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