Files
WeHub Mirror 16d3f15320
ARM CI / build (3.10) (push) Has been cancelled
cffconvert / validate (push) Has been cancelled
Creates a GitHub Issue when a PR Rolled back via Commit to Master / create-issue-on-pr-rollback (push) Has been cancelled
Scorecards supply-chain security / Scorecards analysis (push) Has been cancelled
WeHub snapshot of ee606724a5c2f63bf60704cb3e1b169618993fd9
2026-08-07 16:11:07 +08:00

128 lines
4.0 KiB
Python

# Copyright 2026 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable", "pybind_extension")
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:LICENSE"],
default_visibility = ["//visibility:public"],
licenses = ["notice"],
)
cc_library(
name = "numpy",
srcs = ["numpy.cc"],
hdrs = ["numpy.h"],
compatible_with = get_compatible_with_portable(),
deps = [
"//tensorflow/lite:string_util",
"//tensorflow/lite/core/c:c_api_types",
"//tensorflow/lite/core/c:common",
"//third_party/py/numpy:headers",
"@xla//third_party/python_runtime:headers", # buildcleaner: keep
],
)
cc_library(
name = "interpreter_wrapper_lib",
srcs = ["interpreter_wrapper.cc"],
hdrs = [
"interpreter_wrapper.h",
],
compatible_with = get_compatible_with_portable(),
deps = [
":numpy",
":python_error_reporter",
":python_utils",
"//tensorflow/lite:framework",
"//tensorflow/lite:shared_library",
"//tensorflow/lite:string_util",
"//tensorflow/lite:util",
"//tensorflow/lite/core:framework",
"//tensorflow/lite/core/api",
"//tensorflow/lite/core/c:common",
"//tensorflow/lite/core/kernels:builtin_ops",
"//tensorflow/lite/delegates/xnnpack:xnnpack_delegate",
"//tensorflow/lite/kernels:reference_ops",
"//tensorflow/lite/kernels/internal:compatibility",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:str_format",
"@xla//third_party/python_runtime:headers", # buildcleaner: keep
],
)
cc_library(
name = "python_error_reporter",
srcs = ["python_error_reporter.cc"],
hdrs = ["python_error_reporter.h"],
compatible_with = get_compatible_with_portable(),
deps = [
"//tensorflow/lite:stateful_error_reporter",
"@xla//third_party/python_runtime:headers", # buildcleaner: keep
],
)
cc_library(
name = "python_utils",
srcs = ["python_utils.cc"],
hdrs = ["python_utils.h"],
compatible_with = get_compatible_with_portable(),
deps = [
"@xla//third_party/python_runtime:headers", # buildcleaner: keep
],
)
config_setting(
name = "tflite_pip_with_flex",
define_values = {
"tflite_pip_with_flex": "true",
},
)
pybind_extension(
name = "_pywrap_tensorflow_interpreter_wrapper",
srcs = [
"interpreter_wrapper_pybind11.cc",
],
hdrs = ["interpreter_wrapper.h"],
additional_stubgen_deps = [
"//third_party/py/numpy:numpy",
],
common_lib_packages = [
"litert/python",
"tensorflow/lite/python",
],
compatible_with = get_compatible_with_portable(),
enable_stub_generation = True,
link_in_framework = True,
pytype_srcs = [
"_pywrap_tensorflow_interpreter_wrapper.pyi",
],
wrap_py_init = True,
deps = [
":interpreter_wrapper_lib",
"//tensorflow/lite:framework",
"//tensorflow/lite/core:framework_stable",
"//tensorflow/python/lib/core:pybind11_lib",
"@pybind11",
"@xla//third_party/python_runtime:headers",
] + select({
":tflite_pip_with_flex": ["//tensorflow/lite/delegates/flex:delegate"],
"//conditions:default": [],
}),
)