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

Function lossfun_distortion

utils/stepfun.py:297–307  ·  view source on GitHub ↗

Compute iint w[i] w[j] |t[i] - t[j]| di dj.

(t, w)

Source from the content-addressed store, hash-verified

295
296
297def lossfun_distortion(t, w):
298 """Compute iint w[i] w[j] |t[i] - t[j]| di dj."""
299 # The loss incurred between all pairs of intervals.
300 ut = (t[..., 1:] + t[..., :-1]) / 2
301 dut = torch.abs(ut[..., :, None] - ut[..., None, :])
302 loss_inter = torch.sum(w * torch.sum(w[..., None, :] * dut, dim=-1), dim=-1)
303
304 # The loss incurred within each individual interval with itself.
305 loss_intra = torch.sum(w ** 2 * (t[..., 1:] - t[..., :-1]), dim=-1) / 3
306
307 return loss_inter + loss_intra
308
309
310def interval_distortion(t0_lo, t0_hi, t1_lo, t1_hi):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected