1load("@org_tensorflow//tensorflow/lite/delegates/flex:build_def.bzl", "tflite_flex_cc_library") 2 3package( 4 default_visibility = ["//tensorflow_lite_support:users"], 5 licenses = ["notice"], # Apache 2.0 6) 7 8# This will generate the tf_text_flex_delegate cc_library, which is a custom 9# flex delegate that only contains ops in listed models. 10tflite_flex_cc_library( 11 name = "tf_text_flex_delegate", 12 additional_deps = ["@org_tensorflow_text//tensorflow_text:ops_lib"], 13 models = [ 14 # TODO(b/160817619) Replace with a more complex model. 15 "testdata/sentencepiece_tokenizer_flex_op.tflite", 16 ], 17) 18 19# bazel test --config=monolithic tensorflow_lite_support/custom_ops:tflite_inference_test 20cc_test( 21 name = "tflite_inference_test", 22 srcs = ["tflite_inference_main.cc"], 23 args = ["--model=tensorflow_lite_support/custom_ops/testdata/sentencepiece_tokenizer_flex_op.tflite"], 24 data = ["//tensorflow_lite_support/custom_ops:testdata/sentencepiece_tokenizer_flex_op.tflite"], 25 deps = [ 26 ":tf_text_flex_delegate", 27 "@org_tensorflow//tensorflow/lite:framework", 28 "@org_tensorflow//tensorflow/lite:string_util", 29 "@org_tensorflow//tensorflow/lite/c:common", 30 "@org_tensorflow//tensorflow/lite/kernels:builtin_ops", 31 "@org_tensorflow//tensorflow/lite/tools:command_line_flags", 32 ] + select({ 33 "@org_tensorflow//tensorflow:android": [ 34 "@org_tensorflow//tensorflow/core:portable_tensorflow_lib_lite", 35 ], 36 "@org_tensorflow//tensorflow:ios": [ 37 "@org_tensorflow//tensorflow/core:portable_tensorflow_lib_lite", 38 ], 39 "//conditions:default": [ 40 "@org_tensorflow//tensorflow/core:lib", 41 ], 42 }), 43) 44