chore: import upstream snapshot with attribution
cffconvert / validate (push) Has been skipped
License Check / license-check (push) Failing after 2s

This commit is contained in:
wehub-resource-sync
2026-07-13 12:14:16 +08:00
commit 8a852e4b4e
36502 changed files with 9277225 additions and 0 deletions
@@ -0,0 +1,34 @@
load("@com_google_protobuf//bazel:proto_library.bzl", "proto_library")
load("@rules_python//python:proto.bzl", "py_proto_library")
load("//tensorflow:tensorflow.default.bzl", "get_compatible_with_portable")
load(
"//tensorflow/core/platform:build_config.bzl",
"tf_proto_library",
)
package(
# copybara:uncomment default_applicable_licenses = ["//tensorflow:LICENSE"],
default_visibility = ["//visibility:public"],
licenses = ["notice"],
)
proto_library(
name = "benchmark_result_proto",
srcs = ["benchmark_result.proto"],
compatible_with = get_compatible_with_portable(),
visibility = ["//visibility:public"],
)
tf_proto_library(
name = "benchmark_result", # bzl adds _py for python proto library
srcs = ["benchmark_result.proto"],
visibility = ["//visibility:public"],
)
# copybara:uncomment_begin(google-only)
# py_proto_library(
# name = "benchmark_result_py_pb2",
# compatible_with = get_compatible_with_portable(),
# deps = [":benchmark_result_proto"],
# )
# copybara:uncomment_end
@@ -0,0 +1,36 @@
#
# Copyright 2025 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
#
# https://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.
find_package(Protobuf REQUIRED)
add_library(benchmark_result_proto benchmark_result.proto)
list(APPEND benchmark_result_generated_files
${CMAKE_BINARY_DIR}/tensorflow/lite/tools/benchmark/proto/benchmark_result.pb.cc
${CMAKE_BINARY_DIR}/tensorflow/lite/tools/benchmark/proto/benchmark_result.pb.h)
# Generate benchmark_result.pb.cc and benchmark_result.pb.h from
# benchmark_result.proto using protoc. Once the protobuf package version is
# upgraded, we can use protobuf_generate_cpp/protobuf_generate here directly.
add_custom_command(
OUTPUT ${benchmark_result_generated_files}
COMMAND ${Protobuf_PROTOC_EXECUTABLE}
ARGS --cpp_out=${CMAKE_BINARY_DIR} --proto_path=${TENSORFLOW_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/benchmark_result.proto
DEPENDS ${Protobuf_PROTOC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/benchmark_result.proto
)
set_source_files_properties(${benchmark_result_generated_files} PROPERTIES GENERATED TRUE)
target_sources(benchmark_result_proto PRIVATE ${benchmark_result_generated_files})
target_link_libraries(benchmark_result_proto protobuf::libprotobuf)
target_include_directories(benchmark_result_proto PUBLIC ${CMAKE_BINARY_DIR})
@@ -0,0 +1,73 @@
/* Copyright 2025 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.
==============================================================================*/
syntax = "proto2";
package tflite.tools.benchmark;
option java_multiple_files = true;
option java_package = "tflite.tools.benchmark";
// Next ID: 11
message LatencyMetrics {
// Note all fields defined here refers to wall time by default.
optional float avg_ms = 1;
optional float min_ms = 2;
optional float max_ms = 3;
optional float stddev_ms = 4;
optional float median_ms = 5;
optional float p5_ms = 6;
optional float p95_ms = 7;
optional float init_ms = 8;
optional float first_inference_ms = 9;
optional float average_warm_up_ms = 10;
}
// Next ID: 4
message MemoryMetrics {
// The amount of memory allocated during model initialization. This is the
// delta of memory footprint after the model has been loaded and interpreter
// has been created, compared to the memory footprint at the beginning of the
// benchmark tool.
optional int64 init_footprint_kb = 1;
// The memory allocated during the model initialization and execution.
// This is the delta of memory footprint after the model has been intialized
// and executed, compared to the memory footprint at the beginning of the
// benchmark tool.
optional int64 overall_footprint_kb = 2;
// Peak memory usage (in megabytes).
optional float peak_mem_mb = 3;
}
// Next ID: 5
message MiscMetrics {
optional float model_size_mb = 1;
optional int32 num_runs = 2;
optional int32 num_warmup_runs = 3;
// Model throughput in megabytes per second. This is the average throughput
// of the model over all the inferences.
optional float model_throughput_in_mb_per_sec = 4;
}
// Next ID: 5
message BenchmarkResult {
// The name representing the configuration of the benchmark run.
optional string name = 1;
optional LatencyMetrics latency_metrics = 2;
optional MemoryMetrics memory_metrics = 3;
optional MiscMetrics misc_metrics = 4;
}