(self, x_start, t, noise=None)
| 284 | return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise |
| 285 | |
| 286 | def q_sample(self, x_start, t, noise=None): |
| 287 | noise = default(noise, lambda: torch.randn_like(x_start)) |
| 288 | return ( |
| 289 | extract(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start + |
| 290 | extract(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise |
| 291 | ) |
| 292 | |
| 293 | def p_losses(self, x_start, t, cond, noise=None, nonpadding=None): |
| 294 | noise = default(noise, lambda: torch.randn_like(x_start)) |