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 #include "tensorflow/lite/create_op_resolver.h" 17 #include "tensorflow/lite/mutable_op_resolver.h" 18 19 // This method is generated by `gen_selected_ops`. 20 // TODO(b/174972014): Instead of relying on a global method, make 21 // `gen_selected_ops` generating a header file with custom namespace. 22 void RegisterSelectedOps(::tflite::MutableOpResolver* resolver); 23 24 namespace tflite { 25 // This interface is the unified entry point for creating op resolver 26 // regardless if selective registration is being used. C++ client will call 27 // this method directly and Java client will call this method indirectly via 28 // JNI code in interpreter_jni.cc. CreateOpResolver()29std::unique_ptr<MutableOpResolver> CreateOpResolver() { 30 std::unique_ptr<MutableOpResolver> resolver = 31 std::unique_ptr<MutableOpResolver>(new MutableOpResolver()); 32 RegisterSelectedOps(resolver.get()); 33 return resolver; 34 } 35 36 } // namespace tflite 37