MCPcopy
hub / github.com/Vchitect/Latte / q_mean_variance

Method q_mean_variance

diffusion/gaussian_diffusion.py:203–213  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Callers 1

_prior_bpdMethod · 0.95

Calls 1

_extract_into_tensorFunction · 0.85

Tested by

no test coverage detected