Skip to content

Commit 0841c7c

Browse files
committed
fixed a bug in which max_num_neighbors was not handled correctly
1 parent 99d0792 commit 0841c7c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

csrc/cpu/radius_cpu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ torch::Tensor radius_cpu(torch::Tensor x, torch::Tensor y,
8888
size_t num_matches = mat_index.index->radiusSearch(
8989
y_data + i * y.size(1), r * r + 0.00001, ret_matches, params);
9090

91-
for (size_t j = 0; j < num_matches; j++) {
91+
for (size_t j = 0;
92+
j < std::min(num_matches, (size_t)max_num_neighbors); j++) {
9293
out_vec.push_back(x_start + ret_matches[j].first);
9394
out_vec.push_back(i);
9495
}

0 commit comments

Comments
 (0)