Get the distribution q(x_t | x_0). :param x_start: the [N x C x ...] tensor of noiseless inputs. :param t: the number of diffusion steps (minus 1). Here, 0 means one step. :return: A tuple (mean, variance, log_variance), all of x_start's shape.
(self, x_start, t)
| 201 | ) |
| 202 | |
| 203 | def q_mean_variance(self, x_start, t): |
| 204 | """ |
| 205 | Get the distribution q(x_t | x_0). |
| 206 | :param x_start: the [N x C x ...] tensor of noiseless inputs. |
| 207 | :param t: the number of diffusion steps (minus 1). Here, 0 means one step. |
| 208 | :return: A tuple (mean, variance, log_variance), all of x_start's shape. |
| 209 | """ |
| 210 | mean = _extract_into_tensor(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start |
| 211 | variance = _extract_into_tensor(1.0 - self.alphas_cumprod, t, x_start.shape) |
| 212 | log_variance = _extract_into_tensor(self.log_one_minus_alphas_cumprod, t, x_start.shape) |
| 213 | return mean, variance, log_variance |
| 214 | |
| 215 | def q_sample(self, x_start, t, noise=None): |
| 216 | """ |
no test coverage detected