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") 17 18package( 19 default_visibility = ["//visibility:public"], 20 licenses = ["notice"], 21) 22 23exports_files(glob([ 24 "testdata/**", 25])) 26 27cc_library( 28 name = "evaluation_stage", 29 hdrs = ["evaluation_stage.h"], 30 copts = tflite_copts(), 31 deps = [ 32 "//tensorflow/lite/c:common", 33 "//tensorflow/lite/tools/evaluation/proto:evaluation_config_cc_proto", 34 ], 35) 36 37cc_library( 38 name = "utils", 39 srcs = ["utils.cc"], 40 hdrs = ["utils.h"], 41 copts = tflite_copts(), 42 deps = [ 43 "//tensorflow/lite/c:common", 44 "//tensorflow/lite/delegates/nnapi:nnapi_delegate", 45 "//tensorflow/lite/tools/delegates:delegate_provider_hdr", 46 ] + select({ 47 "//tensorflow/lite/delegates/gpu:supports_gpu_delegate": [ 48 "//tensorflow/lite/delegates/gpu:delegate", 49 ], 50 "//conditions:default": [], 51 }) + select({ 52 "//tensorflow:arm_any": [ 53 "//tensorflow/lite/delegates/hexagon:hexagon_delegate", 54 ], 55 "//conditions:default": [], 56 }) + select({ 57 "//tensorflow:linux_s390x": [], 58 "//tensorflow/lite:tflite_with_xnnpack_explicit_false": [], 59 "//conditions:default": [ 60 "//tensorflow/lite/delegates/xnnpack:xnnpack_delegate", 61 ], 62 }) + select({ 63 "//tensorflow:ios": [ 64 "//tensorflow/lite/delegates/coreml:coreml_delegate", 65 ], 66 "//tensorflow:macos_arm64": [ 67 "//tensorflow/lite/delegates/coreml:coreml_delegate", 68 ], 69 "//conditions:default": [], 70 }), 71) 72 73cc_library( 74 name = "evaluation_delegate_provider", 75 srcs = ["evaluation_delegate_provider.cc"], 76 hdrs = ["evaluation_delegate_provider.h"], 77 copts = tflite_copts(), 78 deps = [ 79 ":utils", 80 "//tensorflow/lite/tools:command_line_flags", 81 "//tensorflow/lite/tools:logging", 82 "//tensorflow/lite/tools:tool_params", 83 "//tensorflow/lite/tools/delegates:delegate_provider_hdr", 84 "//tensorflow/lite/tools/delegates:tflite_execution_providers", 85 "//tensorflow/lite/tools/evaluation/proto:evaluation_stages_cc_proto", 86 ], 87) 88 89cc_test( 90 name = "utils_test", 91 srcs = ["utils_test.cc"], 92 data = [ 93 "testdata/empty.txt", 94 "testdata/labels.txt", 95 ], 96 linkopts = tflite_linkopts(), 97 linkstatic = 1, 98 deps = [ 99 ":utils", 100 "//tensorflow/lite:context", 101 "@com_google_googletest//:gtest_main", 102 ], 103) 104 105cc_test( 106 name = "evaluation_delegate_provider_test", 107 srcs = ["evaluation_delegate_provider_test.cc"], 108 linkopts = tflite_linkopts(), 109 deps = [ 110 ":evaluation_delegate_provider", 111 "//tensorflow/lite/tools:tool_params", 112 "//tensorflow/lite/tools/evaluation/proto:evaluation_stages_cc_proto", 113 "@com_google_googletest//:gtest_main", 114 ], 115) 116