MCPcopy Create free account
hub / github.com/OpenImagingLab/4DSloMo / FurthestSampling

Class FurthestSampling

pointops2/functions/pointops.py:14–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12import time
13
14class FurthestSampling(Function):
15 @staticmethod
16 def forward(ctx, xyz, offset, new_offset):
17 """
18 input: xyz: (n, 3), offset: (b), new_offset: (b)
19 output: idx: (m)
20 """
21 assert xyz.is_contiguous()
22 n, b, n_max = xyz.shape[0], offset.shape[0], offset[0]
23 for i in range(1, b):
24 n_max = max(offset[i] - offset[i-1], n_max)
25 idx = torch.cuda.IntTensor(new_offset[b-1].item()).zero_()
26 tmp = torch.cuda.FloatTensor(n).fill_(1e10)
27 pointops_cuda.furthestsampling_cuda(b, n_max, xyz, offset, new_offset, tmp, idx)
28 del tmp
29 return idx
30
31furthestsampling = FurthestSampling.apply
32

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected