Faiss

- Main Page
- Namespaces
- Classes
- Files

- File List

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
PQCodeDistances.cuh
1 /**
2 * Copyright (c) 2015-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD+Patents license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9
10 #pragma once
11
12 #include "../utils/Tensor.cuh"
13 #include "../utils/NoTypeTensor.cuh"
14 #include <cublas_v2.h>
15
16 namespace faiss { namespace gpu {
17
18 class DeviceMemory;
19
20 /// pqCentroids is of the form (sub q)(sub dim)(code id)
21 /// Calculates the distance from the (query - centroid) residual to
22 /// each sub-code vector, for the given list of query results in
23 /// topQueryToCentroid
24 void runPQCodeDistances(Tensor<float, 3, true>& pqCentroids,
25 Tensor<float, 2, true>& queries,
26 Tensor<float, 2, true>& coarseCentroids,
27 Tensor<int, 2, true>& topQueryToCentroid,
28 NoTypeTensor<4, true>& outCodeDistances,
29 bool useFloat16Lookup,
30 cudaStream_t stream);
31
32 void runPQCodeDistancesMM(Tensor<float, 3, true>& pqCentroids,
33 Tensor<float, 2, true>& queries,
34 Tensor<float, 2, true>& coarseCentroids,
35 Tensor<int, 2, true>& topQueryToCentroid,
36 NoTypeTensor<4, true>& outCodeDistances,
37 bool useFloat16Lookup,
38 DeviceMemory& mem,
39 cublasHandle_t handle,
40 cudaStream_t stream);
41
42 } } // namespace