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

Method q_sample

usr/diff/shallow_diffusion_tts.py:286–291  ·  view source on GitHub ↗
(self, x_start, t, noise=None)

Source from the content-addressed store, hash-verified

284 return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise
285
286 def q_sample(self, x_start, t, noise=None):
287 noise = default(noise, lambda: torch.randn_like(x_start))
288 return (
289 extract(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start +
290 extract(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise
291 )
292
293 def p_losses(self, x_start, t, cond, noise=None, nonpadding=None):
294 noise = default(noise, lambda: torch.randn_like(x_start))

Callers 3

p_lossesMethod · 0.95
forwardMethod · 0.95
forwardMethod · 0.45

Calls 2

defaultFunction · 0.70
extractFunction · 0.70

Tested by

no test coverage detected