Build the linear noise schedule of a diffusion model with num_steps timesteps and return its three per-step arrays.
βt=βstart+T−1t(βend−βstart),αt=1−βt,αˉt=s=0∏tαsHere T is num_steps, the timestep t runs from 0 to T−1, βstart is beta_start and βend is beta_end. The betas are evenly spaced, so the first one equals beta_start and the last one equals beta_end. Each αt is the fraction of variance kept at step t, and each αˉt is the running product of all alphas up to and including step t. When num_steps is 1 the schedule holds the single value beta_start.
Return a dict with exactly the keys "betas", "alphas" and "alpha_bars", where each value is a float64 NumPy array of shape (num_steps,) holding βt, αt and αˉt in timestep order.
Input: num_steps = 5, beta_start = 0.1, beta_end = 0.5
Output: {"betas":[0.1,0.2,0.3,0.4,0.5],"alphas":[0.9,0.8,0.7,0.6,0.5],"alpha_bars":[0.9,0.72,0.504,0.3024,0.1512]}
Explanation: The five betas are evenly spaced from 0.1 to 0.5, each alpha is one minus its beta, and each alpha_bar multiplies the alphas so far, so alpha_bars[1] = 0.9 * 0.8 = 0.72.
Input: num_steps = 4, beta_start = 0.0001, beta_end = 0.02
Output: {"betas":[0.0001,0.006733,0.013367,0.02],"alphas":[0.9999,0.993267,0.986633,0.98],"alpha_bars":[0.9999,0.993167,0.979892,0.960294]}
Input: num_steps = 1, beta_start = 0.3, beta_end = 0.9
Output: {"betas":[0.3],"alphas":[0.7],"alpha_bars":[0.7]}
np.linspace(start, stop, num) includes both endpoints and returns just start when num is 1.
np.cumprod gives an inclusive running product.
Accepts: integer
Accepts: number
Accepts: number
Build the linear noise schedule of a diffusion model with num_steps timesteps and return its three per-step arrays.
βt=βstart+T−1t(βend−βstart),αt=1−βt,αˉt=s=0∏tαsHere T is num_steps, the timestep t runs from 0 to T−1, βstart is beta_start and βend is beta_end. The betas are evenly spaced, so the first one equals beta_start and the last one equals beta_end. Each αt is the fraction of variance kept at step t, and each αˉt is the running product of all alphas up to and including step t. When num_steps is 1 the schedule holds the single value beta_start.
Return a dict with exactly the keys "betas", "alphas" and "alpha_bars", where each value is a float64 NumPy array of shape (num_steps,) holding βt, αt and αˉt in timestep order.
Input: num_steps = 5, beta_start = 0.1, beta_end = 0.5
Output: {"betas":[0.1,0.2,0.3,0.4,0.5],"alphas":[0.9,0.8,0.7,0.6,0.5],"alpha_bars":[0.9,0.72,0.504,0.3024,0.1512]}
Explanation: The five betas are evenly spaced from 0.1 to 0.5, each alpha is one minus its beta, and each alpha_bar multiplies the alphas so far, so alpha_bars[1] = 0.9 * 0.8 = 0.72.
Input: num_steps = 4, beta_start = 0.0001, beta_end = 0.02
Output: {"betas":[0.0001,0.006733,0.013367,0.02],"alphas":[0.9999,0.993267,0.986633,0.98],"alpha_bars":[0.9999,0.993167,0.979892,0.960294]}
Input: num_steps = 1, beta_start = 0.3, beta_end = 0.9
Output: {"betas":[0.3],"alphas":[0.7],"alpha_bars":[0.7]}
np.linspace(start, stop, num) includes both endpoints and returns just start when num is 1.
np.cumprod gives an inclusive running product.
Accepts: integer
Accepts: number
Accepts: number