diff --git a/cpp/src/sampling/neighbor_sampling_impl.hpp b/cpp/src/sampling/neighbor_sampling_impl.hpp index 0b20b57d2b..2ddc85a41b 100644 --- a/cpp/src/sampling/neighbor_sampling_impl.hpp +++ b/cpp/src/sampling/neighbor_sampling_impl.hpp @@ -408,7 +408,7 @@ neighbor_sample_impl(raft::handle_t const& handle, thrust::transform(handle.get_thrust_policy(), thrust::make_counting_iterator(0), - thrust::make_counting_iterator(result_offsets->size()), + thrust::make_counting_iterator(result_offsets->size() - 1), result_offsets->begin() + 1, [result_labels = raft::device_span( cp_result_labels->data(), cp_result_labels->size())] __device__(auto idx) {