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

Function Divide2Patch

pointops2/functions/pointops.py:678–693  ·  view source on GitHub ↗
(nsample, xyz, offset, return_offset=False, anchor_scale=None)

Source from the content-addressed store, hash-verified

676
677
678def Divide2Patch(nsample, xyz, offset, return_offset=False, anchor_scale=None):
679 # nsample: 16 xyz: (n, 3) offset: (b)
680 downsample_scale = anchor_scale or nsample
681 new_offset, count = [offset[0].item() // downsample_scale], offset[0].item() // downsample_scale
682 for i in range(1, offset.shape[0]):
683 count += (offset[i].item() - offset[i-1].item()) // downsample_scale
684 new_offset.append(count)
685 # print("donw sample scale:", downsample_scale,"offset:", offset, "newoffset:", new_offset)
686 new_offset = torch.cuda.IntTensor(new_offset)
687 idx = furthestsampling(xyz, offset, new_offset) # (m)
688 new_xyz = xyz[idx.long()]
689 p_idx, _ = knnquery(nsample, xyz, new_xyz, offset, new_offset) # (m, nsample)
690 if return_offset:
691 return p_idx, new_offset
692 else:
693 return p_idx
694
695class Subtraction(Function):
696 @staticmethod

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected