Diffuse the dataset for a given number of diffusion steps. In other words, sample from q(x_t | x_0). :param x_start: the initial dataset batch. :param t: the number of diffusion steps (minus 1). Here, 0 means one step. :param noise: if specified, the split-
(self, x_start, t, noise=None)
| 224 | return mean, variance, log_variance |
| 225 | |
| 226 | def q_sample(self, x_start, t, noise=None): |
| 227 | """ |
| 228 | Diffuse the dataset for a given number of diffusion steps. |
| 229 | |
| 230 | In other words, sample from q(x_t | x_0). |
| 231 | |
| 232 | :param x_start: the initial dataset batch. |
| 233 | :param t: the number of diffusion steps (minus 1). Here, 0 means one step. |
| 234 | :param noise: if specified, the split-out normal noise. |
| 235 | :return: A noisy version of x_start. |
| 236 | """ |
| 237 | if noise is None: |
| 238 | noise = th.randn_like(x_start) |
| 239 | assert noise.shape == x_start.shape |
| 240 | return ( |
| 241 | _extract_into_tensor(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start |
| 242 | + _extract_into_tensor(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) |
| 243 | * noise |
| 244 | ) |
| 245 | |
| 246 | def q_posterior_mean_variance(self, x_start, x_t, t): |
| 247 | """ |
no test coverage detected