MCPcopy Create free account
hub / github.com/computational-imaging/bacon / expected_sin

Function expected_sin

modules.py:518–524  ·  view source on GitHub ↗

Estimates mean and variance of sin(z), z ~ N(x, var).

(x, x_var)

Source from the content-addressed store, hash-verified

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]."""

Callers 1

integrated_pos_encFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected