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)
| 1865 | return [''.join(chr(i) for i in row if i > 0) for row in tensor.tolist()] |
| 1866 | |
| 1867 | def 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 | |
| 1890 | def FPS(pts, fps_pts_num): |
no outgoing calls
no test coverage detected