Imported Upstream version 1.7.0
[platform/core/ml/nnfw.git] / compiler / tflite2circle / src / DataLookup.h
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd. 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
17 #ifndef __DATA_LOOKUP_H__
18 #define __DATA_LOOKUP_H__
19
20 #include <mio/tflite/schema_generated.h>
21 #include <mio/circle/schema_generated.h>
22
23 namespace tflite2circle
24 {
25
26 /**
27  * @brief Returns circle builtin_code according to tflite.
28  *
29  * @note You can see a list of currently supported BuiltinOperator in TFLOperator.lst file.
30 */
31 circle::BuiltinOperator get_circle_builtin_code(tflite::BuiltinOperator tfl_bop);
32
33 /**
34  * @brief Returns circle TensorType according to tflite.
35  *
36  * @note You can see a list of currently supported TensorType in TFLTensorType.lst file.
37 */
38 circle::TensorType get_circle_tensortype(tflite::TensorType tfl_tt);
39
40 /**
41  * @brief Returns circle Padding enum according to tflite.
42 */
43 circle::Padding get_circle_padding(tflite::Padding tfl_p);
44
45 /**
46  * @brief Returns circle ActivationFunctionType according to tflite.
47  *
48  * @note You can see a list of currently supported ActivationFunctionType in
49  *       TFLActivationFunctionType.lst file.
50 */
51 circle::ActivationFunctionType
52 get_circle_activation_function_type(tflite::ActivationFunctionType tfl_aft);
53
54 /**
55  * @brief Returns circle builtin_options according to tflite.
56  *
57  * @note You can see a list of currently supported BuiltinOptions in
58  *       TFLBuiltinOptions.lst file.
59  *
60  *       This function calls the build_circle_##BuiltinOptions internally(e.g.
61  *       build_circle_AbsOptions, build_circle_AddOptions, etc.), so refer to it for a more
62  *       detailed implementation.
63 */
64 flatbuffers::Offset<void> get_circle_builtin_options(flatbuffers::FlatBufferBuilder &fb,
65                                                      const tflite::Operator *op);
66
67 /**
68  * @brief Returns circle builtin_options_type according to tflite.
69  *
70  * @note You can see a list of currently supported BuiltinOptions in TFLBuiltinOptions.lst file.
71 */
72 circle::BuiltinOptions get_circle_builtin_options_type(const tflite::Operator *op);
73
74 /**
75  * @brief Returns circle MirrorPadMode according to tflite.
76 */
77 circle::MirrorPadMode get_circle_mirrorpad_mode(tflite::MirrorPadMode tfl_mode);
78
79 } // namespace tflite2circle
80
81 #endif // __DATA_LOOKUP_H__