MCPcopy Index your code
hub / github.com/CompVis/diff2flow / get_v

Method get_v

diff2flow/ddpm.py:211–216  ·  view source on GitHub ↗

v-parameterization: sqrt(alpha_bar_t) * eps - sqrt(1 - alpha_bar_t) * x_0

(self, x_start, noise, t)

Source from the content-addressed store, hash-verified

209 return sqrt_alpha_cumprod_t * x_start + sqrt_one_minus_alpha_cumprod_t * noise
210
211 def get_v(self, x_start, noise, t):
212 """ v-parameterization: sqrt(alpha_bar_t) * eps - sqrt(1 - alpha_bar_t) * x_0 """
213 return (
214 extract_into_tensor(self.sqrt_alphas_cumprod, t, x_start.shape) * noise -
215 extract_into_tensor(self.sqrt_one_minus_alphas_cumprod, t, x_start.shape) * x_start
216 )
217
218 def training_losses(self, model: nn.Module, x_start: Tensor, x_noise: Tensor = None, model_kwargs=None):
219 """ x_start = x_0 """

Callers 1

training_lossesMethod · 0.95

Calls 1

extract_into_tensorFunction · 0.70

Tested by

no test coverage detected