1licenses(["notice"]) # Apache 2.0 2 3package(default_visibility = ["//tensorflow:internal"]) 4 5load("//tensorflow:tensorflow.bzl", "py_test") 6 7py_library( 8 name = "interpreter", 9 srcs = [ 10 "interpreter.py", 11 ], 12 srcs_version = "PY2AND3", 13 visibility = ["//visibility:public"], 14 deps = [ 15 "//tensorflow/lite/python/interpreter_wrapper:tensorflow_wrap_interpreter_wrapper", 16 "//third_party/py/numpy", 17 ], 18) 19 20py_test( 21 name = "interpreter_test", 22 srcs = ["interpreter_test.py"], 23 data = ["//tensorflow/lite/python/testdata:interpreter_test_data"], 24 srcs_version = "PY2AND3", 25 tags = [ 26 "no_windows", 27 ], 28 deps = [ 29 ":interpreter", 30 "//tensorflow/python:client_testlib", 31 "//tensorflow/python:framework_test_lib", 32 "//tensorflow/python:platform", 33 "//third_party/py/numpy", 34 ], 35) 36 37py_binary( 38 name = "tflite_convert", 39 srcs = ["tflite_convert.py"], 40 srcs_version = "PY2AND3", 41 visibility = ["//visibility:public"], 42 deps = [":tflite_convert_main_lib"], 43) 44 45py_library( 46 name = "tflite_convert_main_lib", 47 srcs = ["tflite_convert.py"], 48 srcs_version = "PY2AND3", 49 visibility = ["//visibility:public"], 50 deps = [":tflite_convert_lib"], 51) 52 53py_library( 54 name = "tflite_convert_lib", 55 srcs = ["tflite_convert.py"], 56 srcs_version = "PY2AND3", 57 visibility = ["//visibility:public"], 58 deps = [ 59 ":lite", 60 ], 61) 62 63py_library( 64 name = "lite", 65 srcs = ["lite.py"], 66 srcs_version = "PY2AND3", 67 visibility = ["//visibility:public"], 68 deps = [ 69 ":convert", 70 ":convert_saved_model", 71 ":interpreter", 72 ":lite_constants", 73 ":op_hint", 74 "//tensorflow/lite/experimental/examples/lstm:tflite_lstm_ops", 75 "//tensorflow/lite/python/optimize:calibrator", 76 "//tensorflow/python:graph_util", 77 "//tensorflow/python:tf_optimizer", 78 "//tensorflow/python/keras", 79 "//tensorflow/python/saved_model:constants", 80 "//tensorflow/python/saved_model:loader", 81 ], 82) 83 84py_test( 85 name = "lite_test", 86 srcs = ["lite_test.py"], 87 data = ["@tflite_mobilenet_ssd_quant_protobuf//:tflite_graph.pb"], 88 shard_count = 4, 89 srcs_version = "PY2AND3", 90 tags = [ 91 "no_windows", 92 ], 93 deps = [ 94 ":lite", 95 "//tensorflow/python:client_testlib", 96 "//tensorflow/python:framework_test_lib", 97 ], 98) 99 100py_test( 101 name = "lite_v2_test", 102 srcs = ["lite_v2_test.py"], 103 srcs_version = "PY2AND3", 104 tags = [ 105 "no_oss", 106 "no_windows", 107 ], 108 deps = [ 109 ":lite", 110 "//tensorflow/python:client_testlib", 111 "//tensorflow/python:framework_test_lib", 112 ], 113) 114 115py_test( 116 name = "lite_flex_test", 117 srcs = ["lite_flex_test.py"], 118 srcs_version = "PY2AND3", 119 tags = [ 120 # TODO(b/111881877): Enable in oss after resolving op registry issues. 121 "no_oss", 122 "no_windows", 123 ], 124 deps = [ 125 ":lite", 126 "//tensorflow/python:client_testlib", 127 "//tensorflow/python:framework_test_lib", 128 ], 129) 130 131py_library( 132 name = "lite_constants", 133 srcs = ["lite_constants.py"], 134 srcs_version = "PY2AND3", 135 deps = [ 136 "//tensorflow/lite/toco:toco_flags_proto_py", 137 "//tensorflow/python:dtypes", 138 ], 139) 140 141py_library( 142 name = "convert", 143 srcs = ["convert.py"], 144 srcs_version = "PY2AND3", 145 visibility = ["//visibility:public"], 146 deps = [ 147 ":lite_constants", 148 "//tensorflow/lite/toco:model_flags_proto_py", 149 "//tensorflow/lite/toco:toco_flags_proto_py", 150 "//tensorflow/lite/toco/python:tensorflow_wrap_toco", 151 "//tensorflow/lite/toco/python:toco_from_protos", 152 "//tensorflow/python:dtypes", 153 "//tensorflow/python:platform", 154 ], 155) 156 157py_library( 158 name = "op_hint", 159 srcs = ["op_hint.py"], 160 srcs_version = "PY2AND3", 161 visibility = ["//visibility:public"], 162 deps = [ 163 "//tensorflow/core:protos_all_py", 164 "//tensorflow/python:framework", 165 "//tensorflow/python:platform", 166 "//tensorflow/python:util", 167 ], 168) 169 170py_test( 171 name = "convert_test", 172 srcs = ["convert_test.py"], 173 srcs_version = "PY2AND3", 174 deps = [ 175 ":convert", 176 ":interpreter", 177 ":op_hint", 178 "//tensorflow/python:array_ops", 179 "//tensorflow/python:client_testlib", 180 "//tensorflow/python:dtypes", 181 "//tensorflow/python:platform_test", 182 "//tensorflow/python:session", 183 ], 184) 185 186py_library( 187 name = "convert_saved_model", 188 srcs = ["convert_saved_model.py"], 189 srcs_version = "PY2AND3", 190 visibility = [ 191 "//tensorflow/lite:__subpackages__", 192 ], 193 deps = [ 194 ":convert", 195 "//tensorflow/python:graph_util", 196 "//tensorflow/python:platform", 197 "//tensorflow/python/saved_model", 198 ], 199) 200 201py_binary( 202 name = "create_custom_op", 203 srcs = ["create_custom_op.py"], 204 srcs_version = "PY2AND3", 205 visibility = ["//visibility:public"], 206 deps = [ 207 "//tensorflow/contrib/framework:framework_py", 208 "//tensorflow/core:protos_all_py", 209 "//tensorflow/python:platform", 210 "@absl_py//absl/flags", 211 ], 212) 213 214py_test( 215 name = "convert_saved_model_test", 216 srcs = ["convert_saved_model_test.py"], 217 srcs_version = "PY2AND3", 218 tags = [ 219 "no_windows", 220 ], 221 visibility = ["//visibility:public"], 222 deps = [ 223 ":convert_saved_model", 224 "//tensorflow/python:client_testlib", 225 "//tensorflow/python:layers", 226 "//tensorflow/python:nn", 227 "//tensorflow/python:platform_test", 228 "//tensorflow/python:session", 229 "//tensorflow/python/keras", 230 "//tensorflow/python/ops/losses", 231 "//tensorflow/python/saved_model", 232 ], 233) 234