Sample from the time-dependent density p_t xt ~ N(alpha_t * x1 + sigma_t * x0, sigma_min * I), according to Eq. (1) in [3] and for the linear schedule Eq. (14) in [2]. Args: x0 : shape (bs, *dim), represents the source minibatch (noise) x
(self, x0: Tensor, x1: Tensor, t: Tensor)
| 550 | """ Training """ |
| 551 | |
| 552 | def compute_xt(self, x0: Tensor, x1: Tensor, t: Tensor): |
| 553 | """ |
| 554 | Sample from the time-dependent density p_t |
| 555 | xt ~ N(alpha_t * x1 + sigma_t * x0, sigma_min * I), |
| 556 | according to Eq. (1) in [3] and for the linear schedule Eq. (14) in [2]. |
| 557 | |
| 558 | Args: |
| 559 | x0 : shape (bs, *dim), represents the source minibatch (noise) |
| 560 | x1 : shape (bs, *dim), represents the target minibatch (data) |
| 561 | t : shape (bs,) represents the time in [0, 1] |
| 562 | Returns: |
| 563 | xt : shape (bs, *dim), sampled point along the time-dependent density p_t |
| 564 | """ |
| 565 | t = pad_v_like_x(t, x0) |
| 566 | alpha_t = self.schedule.alpha_t(t) |
| 567 | sigma_t = self.schedule.sigma_t(t) |
| 568 | xt = alpha_t * x1 + sigma_t * x0 |
| 569 | if self.sigma_min > 0: |
| 570 | xt += self.sigma_min * torch.randn_like(xt) |
| 571 | return xt |
| 572 | |
| 573 | def compute_ut(self, x0: Tensor, x1: Tensor, t: Tensor): |
| 574 | """ |
no test coverage detected