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_KERNELS_REGISTER_H_ 16 #define TENSORFLOW_LITE_KERNELS_REGISTER_H_ 17 18 #include "tensorflow/lite/model.h" // Legacy. 19 #include "tensorflow/lite/mutable_op_resolver.h" 20 21 namespace tflite { 22 namespace ops { 23 namespace builtin { 24 25 // This built-in op resolver provides a list of TfLite delegates that could be 26 // applied by TfLite interpreter by default. 27 class BuiltinOpResolver : public MutableOpResolver { 28 public: 29 BuiltinOpResolver(); 30 OpResolver::TfLiteDelegatePtrVector GetDelegates( 31 int num_threads) const override; 32 }; 33 34 // TfLite interpreter could apply a TfLite delegate by default. To completely 35 // disable this behavior, one could choose to use the following class 36 // BuiltinOpResolverWithoutDefaultDelegates. 37 class BuiltinOpResolverWithoutDefaultDelegates : public BuiltinOpResolver { 38 public: BuiltinOpResolverWithoutDefaultDelegates()39 BuiltinOpResolverWithoutDefaultDelegates() : BuiltinOpResolver() {} 40 OpResolver::TfLiteDelegatePtrVector GetDelegates(int num_threads) const final; 41 }; 42 43 } // namespace builtin 44 } // namespace ops 45 } // namespace tflite 46 47 #endif // TENSORFLOW_LITE_KERNELS_REGISTER_H_ 48