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

Method q_sample

usr/diff/diffusion.py:269–274  ·  view source on GitHub ↗
(self, x_start, t, noise=None)

Source from the content-addressed store, hash-verified

267 return model_mean + nonzero_mask * (0.5 * model_log_variance).exp() * noise
268
269 def q_sample(self, x_start, t, noise=None):
270 noise = default(noise, lambda: torch.randn_like(x_start))
271 return (
272 extract(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start +
273 extract(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise
274 )
275
276 def p_losses(self, x_start, t, cond, noise=None, nonpadding=None):
277 noise = default(noise, lambda: torch.randn_like(x_start))

Callers 1

p_lossesMethod · 0.95

Calls 2

defaultFunction · 0.70
extractFunction · 0.70

Tested by

no test coverage detected