1/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations 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
21namespace tflite {
22namespace ops {
23namespace builtin {
24
25// This built-in op resolver provides a list of TfLite delegates that could be
26// applied by TfLite interpreter by default.
27class 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.
39class BuiltinOpResolverWithoutDefaultDelegates : public BuiltinOpResolver {
40 public:
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