1 /* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2 Licensed under the Apache License, Version 2.0 (the "License");
3 you may not use this file except in compliance with the License.
4 You may obtain a copy of the License at
5 http://www.apache.org/licenses/LICENSE-2.0
6 Unless required by applicable law or agreed to in writing, software
7 distributed under the License is distributed on an "AS IS" BASIS,
8 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
9 See the License for the specific language governing permissions and
10 limitations under the License.
11 ==============================================================================*/
12 #include "pybind11/pybind11.h"
13 #include "pybind11/pytypes.h"
14 #include "tensorflow/lite/python/testdata/test_registerer.h"
15
PYBIND11_MODULE(_pywrap_test_registerer,m)16 PYBIND11_MODULE(_pywrap_test_registerer, m) {
17 m.doc() = R"pbdoc(
18 _pywrap_test_registerer
19 -----
20 )pbdoc";
21 m.def("get_num_test_registerer_calls", &tflite::get_num_test_registerer_calls,
22 R"pbdoc(
23 Returns the num_test_registerer_calls counter and re-sets it.
24 )pbdoc");
25 m.def(
26 "TF_TestRegisterer",
27 [](uintptr_t resolver) {
28 tflite::TF_TestRegisterer(
29 reinterpret_cast<tflite::MutableOpResolver*>(resolver));
30 },
31 R"pbdoc(
32 Dummy registerer function with the correct signature. Registers a fake
33 custom op needed by test models. Increments the
34 num_test_registerer_calls counter by one.
35 )pbdoc");
36 }
37