Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
VectorResidual.cuh
1 /**
2  * Copyright (c) Facebook, Inc. and its affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 
9 #pragma once
10 
11 #include "../utils/Tensor.cuh"
12 #include "../utils/Float16.cuh"
13 
14 namespace faiss { namespace gpu {
15 
16 // Calculates residual v_i - c_j for all v_i in vecs where j = vecToCentroid[i]
17 void runCalcResidual(Tensor<float, 2, true>& vecs,
18  Tensor<float, 2, true>& centroids,
19  Tensor<int, 1, true>& vecToCentroid,
20  Tensor<float, 2, true>& residuals,
21  cudaStream_t stream);
22 
23 #ifdef FAISS_USE_FLOAT16
24 void runCalcResidual(Tensor<float, 2, true>& vecs,
25  Tensor<half, 2, true>& centroids,
26  Tensor<int, 1, true>& vecToCentroid,
27  Tensor<float, 2, true>& residuals,
28  cudaStream_t stream);
29 #endif
30 
31 } } // namespace