xref: /aosp_15_r20/external/tensorflow/tensorflow/lite/delegates/BUILD (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1# Copyright 2019 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
16load("//tensorflow/lite:build_def.bzl", "tflite_copts", "tflite_linkopts")
17load("//tensorflow:tensorflow.bzl", "get_compatible_with_portable")
18load("//tensorflow/lite:special_rules.bzl", "tflite_portable_test_suite")
19
20package(
21    default_visibility = ["//visibility:public"],
22    licenses = ["notice"],
23)
24
25cc_library(
26    name = "telemetry",
27    srcs = ["telemetry.cc"],
28    hdrs = ["telemetry.h"],
29    compatible_with = get_compatible_with_portable(),
30    copts = tflite_copts(),
31    deps = [
32        "//tensorflow/lite/c:common",
33        "//tensorflow/lite/core/api",
34        "//tensorflow/lite/experimental/acceleration/configuration:configuration_fbs",
35    ],
36)
37
38cc_test(
39    name = "telemetry_test",
40    srcs = ["telemetry_test.cc"],
41    linkopts = tflite_linkopts(),
42    linkstatic = 1,
43    deps = [
44        ":telemetry",
45        "//tensorflow/lite/c:common",
46        "//tensorflow/lite/core/api",
47        "//tensorflow/lite/experimental/acceleration/configuration:configuration_fbs",
48        "//tensorflow/lite/profiling:profile_buffer",
49        "@com_google_googletest//:gtest_main",
50        "@flatbuffers",
51    ],
52)
53
54cc_library(
55    name = "utils",
56    srcs = ["utils.cc"],
57    hdrs = ["utils.h"],
58    compatible_with = get_compatible_with_portable(),
59    copts = tflite_copts(),
60    deps = [
61        "//tensorflow/lite:kernel_api",
62        "//tensorflow/lite:util",
63        "//tensorflow/lite/c:common",
64        "//tensorflow/lite/kernels:kernel_util",
65    ],
66)
67
68cc_library(
69    name = "interpreter_utils",
70    srcs = ["interpreter_utils.cc"],
71    hdrs = ["interpreter_utils.h"],
72    copts = tflite_copts(),
73    deps = [
74        "//tensorflow/lite:framework",
75    ],
76)
77
78cc_test(
79    name = "utils_test",
80    srcs = ["utils_test.cc"],
81    linkopts = tflite_linkopts(),
82    linkstatic = 1,
83    deps = [
84        ":utils",
85        "//tensorflow/lite/c:common",
86        "@com_google_googletest//:gtest_main",
87    ],
88)
89
90cc_test(
91    name = "interpreter_utils_test",
92    size = "small",
93    srcs = ["interpreter_utils_test.cc"],
94    features = ["-dynamic_link_test_srcs"],  # see go/dynamic_link_test_srcs
95    deps = [
96        ":delegate_test_util",
97        ":interpreter_utils",
98        ":utils",
99        "//tensorflow/lite:framework",
100        "//tensorflow/lite:kernel_api",
101        "//tensorflow/lite:string",
102        "//tensorflow/lite:util",
103        "//tensorflow/lite:version",
104        "//tensorflow/lite/c:common",
105        "//tensorflow/lite/kernels:builtin_ops",
106        "//tensorflow/lite/kernels:kernel_util",
107        "//tensorflow/lite/kernels/internal:compatibility",
108        "//tensorflow/lite/schema:schema_conversion_utils",
109        "//tensorflow/lite/schema:schema_fbs",
110        "//tensorflow/lite/testing:util",
111        "//third_party/eigen3",
112        "@com_google_googletest//:gtest_main",
113        "@flatbuffers",
114    ],
115)
116
117cc_test(
118    name = "delegate_test",
119    size = "small",
120    srcs = ["delegate_test.cc"],
121    features = ["-dynamic_link_test_srcs"],  # see go/dynamic_link_test_srcs
122    deps = [
123        ":delegate_test_util",
124        ":interpreter_utils",
125        ":utils",
126        "//tensorflow/lite:framework",
127        "//tensorflow/lite:kernel_api",
128        "//tensorflow/lite:string",
129        "//tensorflow/lite:util",
130        "//tensorflow/lite:version",
131        "//tensorflow/lite/c:common",
132        "//tensorflow/lite/kernels:builtin_ops",
133        "//tensorflow/lite/kernels:kernel_util",
134        "//tensorflow/lite/kernels/internal:compatibility",
135        "//tensorflow/lite/schema:schema_conversion_utils",
136        "//tensorflow/lite/schema:schema_fbs",
137        "//tensorflow/lite/testing:util",
138        "//third_party/eigen3",
139        "@com_google_googletest//:gtest_main",
140        "@flatbuffers",
141    ],
142)
143
144cc_library(
145    name = "delegate_test_util",
146    testonly = True,
147    srcs = ["delegate_test_util.cc"],
148    hdrs = ["delegate_test_util.h"],
149    deps = [
150        ":interpreter_utils",
151        ":utils",
152        "//tensorflow/lite:builtin_ops",
153        "//tensorflow/lite:framework",
154        "//tensorflow/lite:string",
155        "//tensorflow/lite:util",
156        "//tensorflow/lite:version",
157        "//tensorflow/lite/c:common",
158        "//tensorflow/lite/kernels:builtin_ops",
159        "//tensorflow/lite/kernels:kernel_util",
160        "//tensorflow/lite/kernels/internal:compatibility",
161        "//tensorflow/lite/schema:schema_conversion_utils",
162        "//tensorflow/lite/schema:schema_fbs",
163        "//tensorflow/lite/testing:util",
164        "//third_party/eigen3",
165        "@com_google_googletest//:gtest",
166        "@flatbuffers",
167    ],
168)
169
170cc_library(
171    name = "serialization",
172    srcs = ["serialization.cc"],
173    hdrs = ["serialization.h"],
174    compatible_with = get_compatible_with_portable(),
175    copts = tflite_copts(),
176    deps = [
177        "//tensorflow/lite:minimal_logging",
178        "//tensorflow/lite/c:common",
179        "@farmhash_archive//:farmhash",
180        "@flatbuffers",
181    ],
182)
183
184cc_test(
185    name = "serialization_test",
186    srcs = ["serialization_test.cc"],
187    linkopts = tflite_linkopts(),
188    linkstatic = 1,
189    deps = [
190        ":serialization",
191        "//tensorflow/lite:util",
192        "//tensorflow/lite/c:common",
193        "@com_google_googletest//:gtest_main",
194    ],
195)
196
197tflite_portable_test_suite()
198