MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / p_mean_variance

Method p_mean_variance

usr/diff/diffusion.py:250–258  ·  view source on GitHub ↗
(self, x, t, cond, clip_denoised: bool)

Source from the content-addressed store, hash-verified

248 return posterior_mean, posterior_variance, posterior_log_variance_clipped
249
250 def p_mean_variance(self, x, t, cond, clip_denoised: bool):
251 noise_pred = self.denoise_fn(x, t, cond=cond)
252 x_recon = self.predict_start_from_noise(x, t=t, noise=noise_pred)
253
254 if clip_denoised:
255 x_recon.clamp_(-1., 1.)
256
257 model_mean, posterior_variance, posterior_log_variance = self.q_posterior(x_start=x_recon, x_t=x, t=t)
258 return model_mean, posterior_variance, posterior_log_variance
259
260 @torch.no_grad()
261 def p_sample(self, x, t, cond, clip_denoised=True, repeat_noise=False):

Callers 1

p_sampleMethod · 0.95

Calls 2

q_posteriorMethod · 0.95

Tested by

no test coverage detected