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

Method compute_ut

diff2flow/flow.py:573–589  ·  view source on GitHub ↗

Compute the time-dependent conditional vector field ut = alpha_dt_t * x1 + sigma_dt_t * x0, see Eq. (7) in [3]. Args: x0 : Tensor, shape (bs, *dim), represents the source minibatch (noise) x1 : Tensor, shape (bs, *dim), represents the tar

(self, x0: Tensor, x1: Tensor, t: Tensor)

Source from the content-addressed store, hash-verified

571 return xt
572
573 def compute_ut(self, x0: Tensor, x1: Tensor, t: Tensor):
574 """
575 Compute the time-dependent conditional vector field
576 ut = alpha_dt_t * x1 + sigma_dt_t * x0,
577 see Eq. (7) in [3].
578
579 Args:
580 x0 : Tensor, shape (bs, *dim), represents the source minibatch (noise)
581 x1 : Tensor, shape (bs, *dim), represents the target minibatch (data)
582 t : FloatTensor, shape (bs,) represents the time in [0, 1]
583 Returns:
584 ut : conditional vector field
585 """
586 t = pad_v_like_x(t, x0)
587 alpha_dt_t = self.schedule.alpha_dt_t(t)
588 sigma_dt_t = self.schedule.sigma_dt_t(t)
589 return alpha_dt_t * x1 + sigma_dt_t * x0
590
591 def training_losses(self, x1: Tensor, x0: Tensor = None, **cond_kwargs):
592 """

Callers 3

training_lossesMethod · 0.95
validation_lossesMethod · 0.95
training_lossesMethod · 0.80

Calls 3

pad_v_like_xFunction · 0.85
alpha_dt_tMethod · 0.45
sigma_dt_tMethod · 0.45

Tested by

no test coverage detected