1 | /** |
2 | * Copyright 2021 Alibaba, Inc. and its affiliates. All Rights Reserved. |
3 | * |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | * you may not use this file except in compliance with the License. |
6 | * You may obtain a copy of the License at |
7 | * |
8 | * http://www.apache.org/licenses/LICENSE-2.0 |
9 | * |
10 | * Unless required by applicable law or agreed to in writing, software |
11 | * distributed under the License is distributed on an "AS IS" BASIS, |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | * See the License for the specific language governing permissions and |
14 | * limitations under the License. |
15 | |
16 | * \author Haichao.chc |
17 | * \date Jun 2021 |
18 | * \brief Helper class for transforming types |
19 | */ |
20 | |
21 | #include "../typedef.h" |
22 | |
23 | namespace proxima { |
24 | namespace be { |
25 | namespace index { |
26 | |
27 | /* |
28 | * QuantizeTypes support FP16/INT8/INT4 |
29 | */ |
30 | enum class QuantizeTypes : uint32_t { |
31 | UNDEFINED = 0, |
32 | VECTOR_FP16 = 1, |
33 | VECTOR_INT8 = 2, |
34 | VECTOR_INT4 = 3 |
35 | }; |
36 | |
37 | /* |
38 | * Helper calss for transforming some inner types. |
39 | */ |
40 | class IndexHelper { |
41 | public: |
42 | //! Transform data type to proxima feature type |
43 | static FeatureTypes GetProximaFeatureType(DataTypes data_type); |
44 | |
45 | //! Tranform str to quantize type |
46 | static QuantizeTypes GetQuantizeType(const std::string &quantize_type); |
47 | }; |
48 | |
49 | } // end namespace index |
50 | } // namespace be |
51 | } // end namespace proxima |
52 | |