From dde7c53920f16d5da33cde539f617cd80ceb0539 Mon Sep 17 00:00:00 2001 From: Louis Sugy Date: Sat, 14 Jan 2023 00:17:50 +0100 Subject: [PATCH] IVF-Flat bug fix: the *squared* norm is required for expanded distance calculations (#1141) Authors: - Louis Sugy (https://github.com/Nyrio) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Artem M. Chirkin (https://github.com/achirkin) - Tamas Bela Feher (https://github.com/tfeher) URL: https://github.com/rapidsai/raft/pull/1141 --- cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh | 3 +-- cpp/include/raft/spatial/knn/detail/ivf_pq_build.cuh | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh b/cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh index ed2c6bae49..0abd3825e6 100644 --- a/cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh +++ b/cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh @@ -245,8 +245,7 @@ inline auto extend(const handle_t& handle, n_lists, raft::linalg::L2Norm, true, - stream, - raft::sqrt_op()); + stream); RAFT_LOG_TRACE_VEC(ext_index.center_norms()->data_handle(), std::min(dim, 20)); } } diff --git a/cpp/include/raft/spatial/knn/detail/ivf_pq_build.cuh b/cpp/include/raft/spatial/knn/detail/ivf_pq_build.cuh index fa7504866d..ee020606c7 100644 --- a/cpp/include/raft/spatial/knn/detail/ivf_pq_build.cuh +++ b/cpp/include/raft/spatial/knn/detail/ivf_pq_build.cuh @@ -1294,8 +1294,7 @@ auto build( index.n_lists(), raft::linalg::L2Norm, true, - stream, - raft::sqrt_op()); + stream); RAFT_CUDA_TRY(cudaMemcpy2DAsync(index.centers().data_handle() + index.dim(), sizeof(float) * index.dim_ext(), center_norms.data(),