• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   // NOTE: we *deliberately* don't define any virtual functions here to avoid
30   // behavior changes when users pass a derived instance by value or assign a
31   // derived instance to a variable of this class. See "object slicing"
32   // (https://en.wikipedia.org/wiki/Object_slicing)) for details.
33   BuiltinOpResolver();
34 };
35 
36 // TfLite interpreter could apply a TfLite delegate by default. To completely
37 // disable this behavior, one could choose to use the following class
38 // BuiltinOpResolverWithoutDefaultDelegates.
39 class BuiltinOpResolverWithoutDefaultDelegates : public BuiltinOpResolver {
40  public:
BuiltinOpResolverWithoutDefaultDelegates()41   BuiltinOpResolverWithoutDefaultDelegates() : BuiltinOpResolver() {
42     delegate_creators_.clear();
43     opaque_delegate_creators_.clear();
44   }
45 };
46 
47 }  // namespace builtin
48 }  // namespace ops
49 }  // namespace tflite
50 
51 #endif  // TENSORFLOW_LITE_KERNELS_REGISTER_H_
52