MCPcopy Create free account
hub / github.com/Robotics-STAR-Lab/H2-Mapping / gumbel_like

Function gumbel_like

mapping/src/utils/sample_util.py:5–6  ·  view source on GitHub ↗
(u)

Source from the content-addressed store, hash-verified

3
4def sampling_without_replacement(logp, k):
5 def gumbel_like(u):
6 return -torch.log(-torch.log(torch.rand_like(u) + 1e-7) + 1e-7)
7
8 scores = logp + gumbel_like(logp)
9 return scores.topk(k, dim=-1)[1]

Callers 1

Calls 1

logMethod · 0.80

Tested by

no test coverage detected