Faiss

- Main Page
- Namespaces
- Classes
- Files

- File List

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