Wrapper function: transfrom velocity prediction model to score Args: velocity: [batch_dim, ...] shaped tensor; velocity model output x: [batch_dim, ...] shaped tensor; x_t data point t: [batch_dim,] time tensor
(self, velocity, x, t)
| 117 | return diffusion |
| 118 | |
| 119 | def get_score_from_velocity(self, velocity, x, t): |
| 120 | """Wrapper function: transfrom velocity prediction model to score |
| 121 | Args: |
| 122 | velocity: [batch_dim, ...] shaped tensor; velocity model output |
| 123 | x: [batch_dim, ...] shaped tensor; x_t data point |
| 124 | t: [batch_dim,] time tensor |
| 125 | """ |
| 126 | t = pad_v_like_x(t, x) |
| 127 | alpha_t, d_alpha_t = self.compute_alpha_t(t) |
| 128 | sigma_t, d_sigma_t = self.compute_sigma_t(t) |
| 129 | mean = x |
| 130 | reverse_alpha_ratio = alpha_t / d_alpha_t |
| 131 | var = sigma_t**2 - reverse_alpha_ratio * d_sigma_t * sigma_t |
| 132 | score = (reverse_alpha_ratio * velocity - mean) / var |
| 133 | return score |
| 134 | |
| 135 | def get_noise_from_velocity(self, velocity, x, t): |
| 136 | """Wrapper function: transfrom velocity prediction model to denoiser |
no test coverage detected