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

Function invert_cdf_np

utils/stepfun.py:164–172  ·  view source on GitHub ↗

Invert the CDF defined by (t, w) at the points specified by u in [0, 1).

(u, t, w_logits)

Source from the content-addressed store, hash-verified

162
163
164def invert_cdf_np(u, t, w_logits):
165 """Invert the CDF defined by (t, w) at the points specified by u in [0, 1)."""
166 # Compute the PDF and CDF for each weight vector.
167 w = np.exp(w_logits) / np.exp(w_logits).sum(axis=-1, keepdims=True)
168 cw = integrate_weights_np(w)
169 # Interpolate into the inverse CDF.
170 interp_fn = np.interp
171 t_new = interp_fn(u, cw, t)
172 return t_new
173
174
175def sample(rand,

Callers 1

sample_npFunction · 0.85

Calls 1

integrate_weights_npFunction · 0.85

Tested by

no test coverage detected