MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / index_points

Function index_points

utils/common.py:1867–1887  ·  view source on GitHub ↗

Input: pts: input points data, [B, C, N] idx: sample index data, [B, S, [K]] Return: new_points:, indexed points data, [B, C, S, [K]]

(pts, idx)

Source from the content-addressed store, hash-verified

1865 return [''.join(chr(i) for i in row if i > 0) for row in tensor.tolist()]
1866
1867def index_points(pts, idx):
1868 """
1869 Input:
1870 pts: input points data, [B, C, N]
1871 idx: sample index data, [B, S, [K]]
1872 Return:
1873 new_points:, indexed points data, [B, C, S, [K]]
1874 """
1875 batch_size = idx.shape[0]
1876 sample_num = idx.shape[1]
1877 fdim = pts.shape[1]
1878 reshape = False
1879 if len(idx.shape) == 3:
1880 reshape = True
1881 idx = idx.reshape(batch_size, -1)
1882 # (b, c, (s k))
1883 res = torch.gather(pts, 2, idx[:, None].repeat(1, fdim, 1))
1884 if reshape:
1885 res = rearrange(res, 'b c (s k) -> b c s k', s=sample_num)
1886
1887 return res
1888
1889
1890def FPS(pts, fps_pts_num):

Callers 2

FPSFunction · 0.85
get_knn_ptsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected