From 164501769bdc687e343c8eed393c9e24c5a47ffe Mon Sep 17 00:00:00 2001 From: Louis Sugy Date: Fri, 13 Jan 2023 16:13:44 +0100 Subject: [PATCH] Squared norm is required for expanded distance calculations --- cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh | 3 +-- cpp/include/raft/spatial/knn/detail/ivf_flat_search.cuh | 3 +-- cpp/include/raft/spatial/knn/detail/ivf_pq_build.cuh | 3 +-- 3 files changed, 3 insertions(+), 6 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 e951d8fe5d..bfed032c13 100644 --- a/cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh +++ b/cpp/include/raft/spatial/knn/detail/ivf_flat_build.cuh @@ -246,8 +246,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_flat_search.cuh b/cpp/include/raft/spatial/knn/detail/ivf_flat_search.cuh index 8ed71864fd..00ab519752 100644 --- a/cpp/include/raft/spatial/knn/detail/ivf_flat_search.cuh +++ b/cpp/include/raft/spatial/knn/detail/ivf_flat_search.cuh @@ -1114,8 +1114,7 @@ void search_impl(const handle_t& handle, static_cast(n_queries), raft::linalg::L2Norm, true, - stream, - raft::sqrt_op()); + stream); utils::outer_add(query_norm_dev.data(), (IdxT)n_queries, index.center_norms()->data_handle(), 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(),