# Codeblock 16a class NoiseScheduler: def __init__(self): self.betas = torch.linspace(BETA_START, BETA_END, NUM_TIMESTEPS) #(1) self.alphas = 1. - self.betas self.alphas_cum_prod = torch.cumprod(self.alphas, dim=0) self.sqrt_alphas_cum_prod = torch.sqrt(self.alphas_cum_prod) self.sqrt_one_minus_alphas_cum_prod = torch.sqrt(1. - self.alphas_cum_prod)