Skip to content

Commit 14c7e1c

Browse files
committed
fix empty col bug
1 parent e8214d4 commit 14c7e1c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

torch_cluster/radius.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def radius(x: torch.Tensor, y: torch.Tensor, r: float,
9292

9393
tree = scipy.spatial.cKDTree(x.detach().numpy())
9494
col = tree.query_ball_point(y.detach().numpy(), r)
95-
col = [sample(torch.tensor(c), max_num_neighbors) for c in col]
95+
col = [torch.tensor(c, dtype=torch.long) for c in col]
96+
col = [sample(c, max_num_neighbors) for c in col]
9697
row = [torch.full_like(c, i) for i, c in enumerate(col)]
9798
row, col = torch.cat(row, dim=0), torch.cat(col, dim=0)
9899
mask = col < int(tree.n)

0 commit comments

Comments
 (0)