• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package(default_visibility = [
2    "//visibility:public",
3])
4
5licenses(["notice"])  # Apache 2.0
6
7load(
8    "//tensorflow/contrib/lite:build_def.bzl",
9    "gen_zipped_test_files",
10)
11load(
12    "//tensorflow:tensorflow.bzl",
13    "tf_cc_test",
14)
15
16gen_zipped_test_files(
17    name = "optest",
18    files = [
19        "add.zip",
20        "avg_pool.zip",
21        "batch_to_space_nd.zip",
22        "concat.zip",
23        "constant.zip",
24        "control_dep.zip",
25        "conv.zip",
26        "depthwiseconv.zip",
27        "div.zip",
28        "exp.zip",
29        "fully_connected.zip",
30        "fused_batch_norm.zip",
31        "gather.zip",
32        "global_batch_norm.zip",
33        "l2_pool.zip",
34        "l2norm.zip",
35        "local_response_norm.zip",
36        "max_pool.zip",
37        "mean.zip",
38        "mul.zip",
39        "pad.zip",
40        "relu.zip",
41        "relu1.zip",
42        "relu6.zip",
43        "reshape.zip",
44        "resize_bilinear.zip",
45        "sigmoid.zip",
46        "softmax.zip",
47        "space_to_batch_nd.zip",
48        "space_to_depth.zip",
49        "split.zip",
50        "squeeze.zip",
51        "strided_slice.zip",
52        "sub.zip",
53        "topk.zip",
54        "transpose.zip",
55    ],
56)
57
58py_binary(
59    name = "generate_examples",
60    srcs = ["generate_examples.py"],
61    data = [
62        "//tensorflow/contrib/lite/toco",
63    ],
64    srcs_version = "PY2AND3",
65    deps = [
66        ":generate_examples_report",
67        "//tensorflow:tensorflow_py",
68        "//tensorflow/python:graph_util",
69        "//third_party/py/numpy",
70        "@six_archive//:six",
71    ],
72)
73
74py_library(
75    name = "generate_examples_report",
76    srcs = ["generate_examples_report.py"],
77    srcs_version = "PY2AND3",
78)
79
80cc_library(
81    name = "parse_testdata_lib",
82    srcs = ["parse_testdata.cc"],
83    hdrs = ["parse_testdata.h"],
84    deps = [
85        ":message",
86        ":split",
87        ":test_runner",
88        "//tensorflow/contrib/lite:framework",
89    ],
90)
91
92cc_library(
93    name = "message",
94    srcs = ["message.cc"],
95    hdrs = ["message.h"],
96    deps = [":tokenize"],
97)
98
99cc_test(
100    name = "message_test",
101    srcs = ["message_test.cc"],
102    deps = [
103        ":message",
104        "@com_google_googletest//:gtest_main",
105    ],
106)
107
108cc_library(
109    name = "split",
110    srcs = ["split.cc"],
111    hdrs = ["split.h"],
112    deps = [
113        "//tensorflow/contrib/lite:string",
114    ],
115)
116
117cc_test(
118    name = "split_test",
119    size = "small",
120    srcs = ["split_test.cc"],
121    deps = [
122        ":split",
123        "@com_google_googletest//:gtest_main",
124    ],
125)
126
127cc_library(
128    name = "join",
129    hdrs = ["join.h"],
130)
131
132cc_test(
133    name = "join_test",
134    size = "small",
135    srcs = ["join_test.cc"],
136    deps = [
137        ":join",
138        "@com_google_googletest//:gtest_main",
139    ],
140)
141
142cc_library(
143    name = "tflite_driver",
144    srcs = ["tflite_driver.cc"],
145    hdrs = ["tflite_driver.h"],
146    deps = [
147        ":split",
148        ":test_runner",
149        "//tensorflow/contrib/lite:framework",
150        "//tensorflow/contrib/lite/kernels:builtin_ops",
151    ],
152)
153
154cc_test(
155    name = "tflite_driver_test",
156    size = "small",
157    srcs = ["tflite_driver_test.cc"],
158    data = ["//tensorflow/contrib/lite:testdata/multi_add.bin"],
159    deps = [
160        ":tflite_driver",
161        "@com_google_googletest//:gtest_main",
162    ],
163)
164
165cc_library(
166    name = "tokenize",
167    srcs = ["tokenize.cc"],
168    hdrs = ["tokenize.h"],
169    deps = [
170        "//tensorflow/contrib/lite:string",
171    ],
172)
173
174cc_test(
175    name = "tokenize_test",
176    srcs = ["tokenize_test.cc"],
177    deps = [
178        ":tokenize",
179        "@com_google_googletest//:gtest_main",
180    ],
181)
182
183cc_library(
184    name = "test_runner",
185    hdrs = ["test_runner.h"],
186    deps = [
187        "//tensorflow/contrib/lite:string",
188    ],
189)
190
191cc_library(
192    name = "util",
193    testonly = 1,
194    hdrs = ["util.h"],
195)
196
197cc_test(
198    name = "test_runner_test",
199    srcs = ["test_runner_test.cc"],
200    deps = [
201        ":test_runner",
202        "@com_google_googletest//:gtest_main",
203    ],
204)
205
206cc_binary(
207    name = "nnapi_example",
208    srcs = ["nnapi_example.cc"],
209    deps = [
210        ":parse_testdata_lib",
211        ":tflite_driver",
212        "//tensorflow/contrib/lite/nnapi:nnapi_lib",
213    ],
214)
215
216cc_library(
217    name = "tf_driver",
218    srcs = ["tf_driver.cc"],
219    hdrs = ["tf_driver.h"],
220    deps = [
221        ":join",
222        ":split",
223        ":test_runner",
224        "//tensorflow/core:core_cpu",
225        "//tensorflow/core:framework",
226        "//tensorflow/core:lib",
227        "//tensorflow/core:protos_all_cc",
228        "//tensorflow/core:tensorflow",
229    ],
230)
231
232cc_test(
233    name = "tf_driver_test",
234    size = "small",
235    srcs = ["tf_driver_test.cc"],
236    data = ["//tensorflow/contrib/lite:testdata/multi_add.pb"],
237    deps = [
238        ":tf_driver",
239        "@com_google_googletest//:gtest_main",
240    ],
241)
242
243tf_cc_test(
244    name = "generated_examples_zip_test",
245    size = "large",
246    srcs = ["generated_examples_zip_test.cc"],
247    args = [
248        "--zip_files_dir=tensorflow/contrib/lite/testing/optest",
249        # TODO(angerson) We may be able to add an external unzip binary instead
250        # of relying on an existing one for OSS builds.
251        "--unzip_binary_path=/usr/bin/unzip",
252    ],
253    data = [":optest"],
254    shard_count = 20,
255    tags = ["no_oss"],
256    deps = [
257        ":parse_testdata_lib",
258        ":tflite_driver",
259        ":util",
260        "@com_google_googletest//:gtest",
261        "@com_googlesource_code_re2//:re2",
262        "//tensorflow/contrib/lite:builtin_op_data",
263        "//tensorflow/contrib/lite:framework",
264        "//tensorflow/contrib/lite/kernels:builtin_ops",
265    ] + select({
266        "//conditions:default": [
267            "//tensorflow/core:framework_internal",
268            "//tensorflow/core:lib",
269            "//tensorflow/core:test",
270        ],
271        "//tensorflow:android": [
272            "//tensorflow/core:android_tensorflow_lib",
273            "//tensorflow/core:android_tensorflow_test_lib",
274        ],
275    }),
276)
277
278filegroup(
279    name = "all_files",
280    srcs = glob(
281        ["**/*"],
282        exclude = [
283            "**/METADATA",
284            "**/OWNERS",
285        ],
286    ),
287    visibility = ["//tensorflow:__subpackages__"],
288)
289