(self, x_start, t, noise=None)
| 267 | return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise |
| 268 | |
| 269 | def q_sample(self, x_start, t, noise=None): |
| 270 | noise = default(noise, lambda: torch.randn_like(x_start)) |
| 271 | return ( |
| 272 | extract(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start + |
| 273 | extract(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise |
| 274 | ) |
| 275 | |
| 276 | def p_losses(self, x_start, t, cond, noise=None, nonpadding=None): |
| 277 | noise = default(noise, lambda: torch.randn_like(x_start)) |