Diffuse the data (t == 0 means diffused for 1 step)
(self, x_start, t, noise=None)
| 99 | return mean, variance, log_variance |
| 100 | |
| 101 | def q_sample(self, x_start, t, noise=None): |
| 102 | """ |
| 103 | Diffuse the data (t == 0 means diffused for 1 step) |
| 104 | """ |
| 105 | if noise is None: |
| 106 | noise = tf.random_normal(shape=x_start.shape) |
| 107 | assert noise.shape == x_start.shape |
| 108 | return ( |
| 109 | self._extract(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start + |
| 110 | self._extract(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise |
| 111 | ) |
| 112 | |
| 113 | def q_posterior_mean_variance(self, x_start, x_t, t): |
| 114 | """ |
no test coverage detected