Skip to content

Commit 3721d15

Browse files
Some error checking
1 parent 8bab0de commit 3721d15

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

torch_points/torchpoints.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ def furthest_point_sample(xyz, npoint):
2929
torch.Tensor
3030
(B, npoint) tensor containing the set
3131
"""
32+
if npoint > xyz.shape[1]:
33+
raise ValueError("caanot sample %i points from an input set of %i points" % (npoint, xyz.shape[1]))
3234
if xyz.is_cuda:
3335
return tpcuda.furthest_point_sampling(xyz, npoint)
3436
else:
@@ -52,6 +54,8 @@ def three_nn(unknown, known):
5254
idx : torch.Tensor
5355
(B, n, 3) index of 3 nearest neighbors
5456
"""
57+
if unknown.shape[1] < 3:
58+
raise ValueError("Not enough points. unknown should ahve at least 3 points.")
5559
if unknown.is_cuda:
5660
dist2, idx = tpcuda.three_nn(unknown, known)
5761
else:

0 commit comments

Comments
 (0)