xref: /aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/flex/delegate_symbol.cc (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2021 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/c/c_api_types.h"
17 #include "tensorflow/lite/delegates/flex/delegate.h"
18 namespace tflite {
19 // Corresponding weak declaration found in lite/interpreter_builder.cc.
20 #if TFLITE_HAS_ATTRIBUTE_WEAK
21 // If weak symbol is not supported (Windows), it can use
22 // TF_AcquireFlexDelegate() path instead.
AcquireFlexDelegate()23 TfLiteDelegateUniquePtr AcquireFlexDelegate() {
24   return tflite::FlexDelegate::Create();
25 }
26 #endif
27 
28 }  // namespace tflite
29 
30 // LINT.IfChange
31 // Exported C interface function which is used by AcquireFlexDelegate() at
32 // interpreter_builder.cc. To export the function name globally, the function
33 // name must be matched with patterns in tf_version_script.lds. In Android, we
34 // don't use this feature so skip building.
35 #if !defined(__ANDROID__)
36 extern "C" {
TF_AcquireFlexDelegate()37 TFL_CAPI_EXPORT tflite::TfLiteDelegateUniquePtr TF_AcquireFlexDelegate() {
38   return tflite::FlexDelegate::Create();
39 }
40 }  // extern "C"
41 #endif  // !defined(__ANDROID__)
42 // LINT.ThenChange(//tensorflow/lite/interpreter_builder.cc)
43