MCPcopy Create free account
hub / github.com/NVlabs/CTG / q_sample

Method q_sample

tbsim/models/diffuser.py:1006–1011  ·  view source on GitHub ↗
(self, x_start, t, noise)

Source from the content-addressed store, hash-verified

1004 #------------------------------------------ training ------------------------------------------#
1005
1006 def q_sample(self, x_start, t, noise):
1007 sample = (
1008 extract(self.sqrt_alphas_cumprod, t, x_start.shape) * x_start +
1009 extract(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * noise
1010 )
1011 return sample
1012
1013 def p_losses(self, x_start_init, t, data_batch, aux_info={}):
1014 noise_init = torch.randn_like(x_start_init)

Callers 1

p_lossesMethod · 0.95

Calls 1

extractFunction · 0.85

Tested by

no test coverage detected