All problems
v-Prediction Conversion
Problem
Convert a v-prediction back to the clean sample: x0 = sqrt(alpha_bar_t) * x_t - sqrt(1 - alpha_bar_t) * v.
The signature is v_prediction_to_x0(x_t, v, alpha_bar_t). All values are scalars.
Hint
v-prediction stays well-conditioned at both very low and very high noise levels.
Test cases
case 1
in: [1,0,0.5]
expected: 0.7071067812
case 2
in: [1,1,1]
expected: 1
case 3
in: [0,1,0]
expected: -1
case 4
in: [2,0.5,0.25]
expected: 0.5669872981
Starter codePython
import math
def v_prediction_to_x0(x_t, v, alpha_bar_t):
# Your code here
pass4 test cases · run your code against them in the editor