MCPcopy Create free account
hub / github.com/openai/point-e / q_mean_variance

Method q_mean_variance

point_e/diffusion/gaussian_diffusion.py:201–212  ·  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

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

Callers 1

_prior_bpdMethod · 0.95

Calls 1

_extract_into_tensorFunction · 0.85

Tested by

no test coverage detected