Estimates mean and variance of sin(z), z ~ N(x, var).
(x, x_var)
| 516 | |
| 517 | # adapted from mipnerf https://github.com/google/mipnerf |
| 518 | def expected_sin(x, x_var): |
| 519 | """Estimates mean and variance of sin(z), z ~ N(x, var).""" |
| 520 | |
| 521 | # When the variance is wide, shrink sin towards zero. |
| 522 | y = torch.exp(-0.5 * x_var) * torch.sin(x) |
| 523 | y_var = torch.clip(0.5 * (1 - torch.exp(-2 * x_var) * torch.cos(2 * x)) - y**2, 0) |
| 524 | return y, y_var |
| 525 | |
| 526 | def integrated_pos_enc(x_coord, min_deg, max_deg): |
| 527 | """Encode `x` with sinusoids scaled by 2^[min_deg:max_deg-1].""" |
no outgoing calls
no test coverage detected