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

Function sample_rays

mapping/src/utils/sample_util.py:17–23  ·  view source on GitHub ↗
(mask, num_samples)

Source from the content-addressed store, hash-verified

15
16
17def sample_rays(mask, num_samples):
18 B, H, W = mask.shape
19 mask_unfold = mask.reshape(-1)
20 indices = torch.rand_like(mask_unfold).topk(num_samples)[1]
21 sampled_masks = (torch.zeros_like(
22 mask_unfold).scatter_(-1, indices, 1).reshape(B, H, W) > 0)
23 return sampled_masks

Callers 1

sample_raysMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected