Skip to contents

x_{t-1} = (x_t - ((1-a_t)/sqrt(1-ab_t)) eps) / sqrt(a_t) + sigma z.

Usage

morie_geron_ddpm_reverse_step(
  x_t,
  t,
  eps_pred,
  alpha,
  alpha_bar,
  sigma,
  z = NULL,
  seed = 0
)

Arguments

x_t, eps_pred

Numeric objects of the same shape.

t

0-based timestep.

alpha, alpha_bar

Schedules indexed by t.

sigma

Non-negative noise scale; 0 gives the DDIM step.

z

Optional noise; otherwise LCG normals.

seed

LCG seed.

Value

List with x_prev, mean, noise_term, eps_coef, x0_estimate, alpha_t, alpha_bar_t.

Examples

alpha <- rep(0.98, 10)
alpha_bar <- cumprod(alpha)
morie_geron_ddpm_reverse_step(c(0.4, -0.2, 0.9), t = 3,
                              eps_pred = c(0.1, -0.05, 0.2),
                              alpha = alpha, alpha_bar = alpha_bar,
                              sigma = sqrt(1 - alpha[4]),
                              z = c(0.3, -0.1, 0.2))
#> $x_prev
#> [1]  0.4392364 -0.2125472  0.9229196
#> 
#> $mean
#> [1]  0.3968100 -0.1984050  0.8946353
#> 
#> $noise_term
#> [1]  0.04242641 -0.01414214  0.02828427
#> 
#> $eps_coef
#> [1] 0.07178109
#> 
#> $x0_estimate
#> [1]  0.3874818 -0.1937409  0.8790869
#> 
#> $alpha_t
#> [1] 0.98
#> 
#> $alpha_bar_t
#> [1] 0.9223682
#> 
#> $sigma
#> [1] 0.1414214
#> 
#> $estimate
#> [1]  0.4392364 -0.2125472  0.9229196
#> 
#> $n
#> [1] 3
#>