MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / inner_outer

Function inner_outer

utils/stepfun.py:36–49  ·  view source on GitHub ↗

Construct inner and outer measures on (t1, y1) for t0.

(t0, t1, y1)

Source from the content-addressed store, hash-verified

34
35
36def inner_outer(t0, t1, y1):
37 """Construct inner and outer measures on (t1, y1) for t0."""
38 cy1 = torch.cat([torch.zeros_like(y1[..., :1]),
39 torch.cumsum(y1, dim=-1)],
40 dim=-1)
41 idx_lo, idx_hi = searchsorted(t1, t0)
42
43 cy1_lo = torch.take_along_dim(cy1, idx_lo, dim=-1)
44 cy1_hi = torch.take_along_dim(cy1, idx_hi, dim=-1)
45
46 y0_outer = cy1_hi[..., 1:] - cy1_lo[..., :-1]
47 y0_inner = torch.where(idx_hi[..., :-1] <= idx_lo[..., 1:],
48 cy1_lo[..., 1:] - cy1_hi[..., :-1], torch.zeros_like(idx_lo[..., 1:]))
49 return y0_inner, y0_outer
50
51
52def lossfun_outer(t, w, t_env, w_env):

Callers 1

lossfun_outerFunction · 0.85

Calls 1

searchsortedFunction · 0.85

Tested by

no test coverage detected