Files
wehub-resource-sync 8a852e4b4e
cffconvert / validate (push) Has been skipped
License Check / license-check (push) Failing after 2s
chore: import upstream snapshot with attribution
2026-07-13 12:14:16 +08:00

75 lines
2.2 KiB
Python

# Description:
# TensorFlow C++ inference example for labeling images.
load("@xla//third_party/rules_python/python:py_binary.bzl", "py_binary")
load("//tensorflow:tensorflow.bzl", "tf_cc_binary")
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
default_visibility = ["//tensorflow:internal"],
licenses = ["notice"],
)
exports_files(["data/grace_hopper.jpg"])
tf_cc_binary(
name = "label_image",
srcs = [
"main.cc",
],
linkopts = select({
"//tensorflow:android": [
"-pie",
"-landroid",
"-ljnigraphics",
"-llog",
"-lm",
"-z defs",
"-s",
"-Wl,--exclude-libs,ALL",
],
"//conditions:default": ["-lm"],
}),
deps = select({
"//tensorflow:android": [
"//tensorflow/core:portable_tensorflow_lib",
# cc:android_tensorflow_image_op is for including jpeg/gif/png
# decoder to enable real-image evaluation on Android
"//tensorflow/core/kernels/image:android_tensorflow_image_op",
],
"//conditions:default": [
"//tensorflow/core:core_cpu",
"//tensorflow/core:framework",
"//tensorflow/core:framework_internal",
"//tensorflow/core:lib",
"//tensorflow/core:protos_all_cc",
"//tensorflow/core:tensorflow",
],
}) + [
"@com_google_absl//absl/log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/strings:string_view",
"@com_google_absl//absl/types:span",
"//tensorflow/cc:ops",
"//tensorflow/cc:scope",
"@xla//xla/tsl/util:command_line_flags",
"@xla//xla/tsl/platform:status",
"@xla//xla/tsl/platform:types",
# cc:cc_ops is used to include image ops (for label_image)
# Jpg, gif, and png related code won't be included
"//tensorflow/cc:cc_ops",
],
)
py_binary(
name = "label_image_py",
srcs = ["label_image.py"],
main = "label_image.py",
strict_deps = True,
deps = [
"//tensorflow:tensorflow_py",
"//third_party/py/numpy",
],
)