• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2020 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 
16 // Python wrapper to modify model interface.
17 
18 #include "tensorflow/lite/tools/optimize/modify_model_interface.h"
19 
20 #include <string>
21 
22 #include "pybind11/pybind11.h"
23 #include "tensorflow/lite/schema/schema_generated.h"
24 
25 namespace pybind11 {
26 
PYBIND11_MODULE(_pywrap_modify_model_interface,m)27 PYBIND11_MODULE(_pywrap_modify_model_interface, m) {
28   // An anonymous function that invokes the C++ function
29   // after applying transformations to the python function arguments
30   m.def("modify_model_interface",
31         [](const std::string& input_file, const std::string& output_file,
32            const int input_type, const int output_type) -> int {
33           return tflite::optimize::ModifyModelInterface(
34               input_file, output_file,
35               static_cast<tflite::TensorType>(input_type),
36               static_cast<tflite::TensorType>(output_type));
37         });
38 }
39 
40 }  // namespace pybind11
41