1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 #ifndef TENSORFLOW_LITE_TOCO_TFLITE_IMPORT_H_
16 #define TENSORFLOW_LITE_TOCO_TFLITE_IMPORT_H_
17 
18 #include "tensorflow/lite/schema/schema_generated.h"
19 #include "tensorflow/lite/toco/model.h"
20 
21 namespace toco {
22 
23 namespace tflite {
24 
25 // Parse the given string as TF Lite flatbuffer and return a new tf.mini model.
26 std::unique_ptr<Model> Import(const ModelFlags &model_flags,
27                               const string &input_file_contents);
28 
29 namespace details {
30 
31 // The names of all tensors found in a TF Lite model.
32 using TensorsTable = std::vector<string>;
33 
34 // The names of all operators found in TF Lite model. If the operator is
35 // builtin, the string representation of the corresponding enum value is used
36 // as name.
37 using OperatorsTable = std::vector<string>;
38 
39 void LoadTensorsTable(const ::tflite::Model &input_model,
40                       TensorsTable *tensors_table);
41 void LoadOperatorsTable(const ::tflite::Model &input_model,
42                         OperatorsTable *operators_table);
43 
44 }  // namespace details
45 }  // namespace tflite
46 
47 }  // namespace toco
48 
49 #endif  // TENSORFLOW_LITE_TOCO_TFLITE_IMPORT_H_
50