1load("//tensorflow/java:build_defs.bzl", "JAVACOPTS") 2load("//tensorflow/lite/delegates/flex:build_def.bzl", "tflite_flex_jni_library") 3load("@build_bazel_rules_apple//apple:ios.bzl", "ios_static_framework") 4load("@bazel_skylib//rules:build_test.bzl", "build_test") 5 6# Following targets are using for testing selective-built flex delegate 7# in Java. Please don't use them for other purposes. 8 9package( 10 default_visibility = [ 11 "//tensorflow/lite/android:__subpackages__", 12 ], 13 licenses = ["notice"], 14) 15 16tflite_flex_jni_library( 17 name = "test", 18 testonly = 1, 19 additional_deps = ["//tensorflow/lite/python/testdata:double_op_and_kernels"], 20 models = [ 21 "//tensorflow/lite:testdata/multi_add_flex.bin", 22 "//tensorflow/lite:testdata/double_flex.bin", 23 ], 24) 25 26java_library( 27 name = "test_tensorflowlitelib_flex", 28 testonly = 1, 29 srcs = ["//tensorflow/lite/delegates/flex/java/src/main/java/org/tensorflow/lite/flex:flex_delegate"], 30 javacopts = JAVACOPTS, 31 visibility = ["//visibility:private"], 32 deps = [ 33 ":libtensorflowlite_flex_jni.so", 34 "//tensorflow/lite/java:tensorflowlitelib", 35 "@org_checkerframework_qual", 36 ], 37) 38 39java_test( 40 name = "SelectiveBuiltInterpreterFlexTest", 41 size = "small", 42 srcs = [ 43 "//tensorflow/lite/java:portable_flex_tests", 44 "//tensorflow/lite/java:portable_test_utils", 45 ], 46 data = [ 47 "//tensorflow/lite:testdata/multi_add_flex.bin", 48 ], 49 javacopts = JAVACOPTS, 50 tags = [ 51 "no_cuda_on_cpu_tap", # CUDA + flex is not officially supported. 52 "no_gpu", # GPU + flex is not officially supported. 53 "no_oss", # Currently requires --config=monolithic, b/118895218. 54 "notsan", # TODO(b/185859069) Re-enable after fixing race condition. 55 ], 56 test_class = "org.tensorflow.lite.InterpreterFlexTest", 57 visibility = ["//visibility:private"], 58 deps = [ 59 ":test_tensorflowlitelib_flex", 60 "//tensorflow/lite/java:tensorflowlitelib", 61 "@com_google_truth", 62 "@junit", 63 ], 64) 65 66java_test( 67 name = "SelectiveBuiltInterpreterFlexWithCustomOpsTest", 68 size = "small", 69 srcs = [ 70 "//tensorflow/lite/java:portable_flex_with_custom_ops_tests", 71 "//tensorflow/lite/java:portable_test_utils", 72 ], 73 data = [ 74 "//tensorflow/lite:testdata/double_flex.bin", 75 ], 76 javacopts = JAVACOPTS, 77 tags = [ 78 "no_cuda_on_cpu_tap", # CUDA + flex is not officially supported. 79 "no_gpu", # GPU + flex is not officially supported. 80 "no_oss", # Currently requires --config=monolithic, b/118895218. 81 "notsan", # TODO(b/185859069) Re-enable after fixing race condition. 82 ], 83 test_class = "org.tensorflow.lite.InterpreterFlexWithCustomOpsTest", 84 visibility = ["//visibility:private"], 85 deps = [ 86 ":test_tensorflowlitelib_flex", 87 "//tensorflow/lite/java:tensorflowlitelib", 88 "@com_google_truth", 89 "@junit", 90 ], 91) 92 93# For build test only. 94ios_static_framework( 95 name = "TestTensorFlowLiteSelectTfOps_framework", 96 testonly = 1, 97 avoid_deps = ["//tensorflow/lite/c:common"], 98 bundle_name = "TestTensorFlowLiteSelectTfOps", 99 minimum_os_version = "9.0", 100 deps = [ 101 ":test_flex_delegate", 102 ], 103) 104 105build_test( 106 name = "framework_build_test", 107 # build_test targets are not meant to be run with sanitizers, and can also 108 # cause problems with coverage testing. 109 tags = [ 110 "noasan", 111 "nomsan", 112 "notsan", 113 "nozapfhahn", 114 ], 115 targets = [ 116 ":TestTensorFlowLiteSelectTfOps_framework", 117 ], 118) 119