Remove tools/benchmark/logging.h and simply use tools/logging.h instead.
PiperOrigin-RevId: 306358463 Change-Id: I0aef70e0beb29a7de0434f3ef2a9e966aefaa87d
This commit is contained in:
parent
ec7d51c3bf
commit
43f67e0881
@ -9,6 +9,8 @@ package(
|
|||||||
licenses = ["notice"], # Apache 2.0
|
licenses = ["notice"], # Apache 2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
exports_files(["logging.h"])
|
||||||
|
|
||||||
common_copts = ["-Wall"]
|
common_copts = ["-Wall"]
|
||||||
|
|
||||||
py_binary(
|
py_binary(
|
||||||
|
@ -9,19 +9,8 @@ package(
|
|||||||
licenses = ["notice"], # Apache 2.0
|
licenses = ["notice"], # Apache 2.0
|
||||||
)
|
)
|
||||||
|
|
||||||
exports_files(["logging.h"])
|
|
||||||
|
|
||||||
common_copts = ["-Wall"] + tflite_copts()
|
common_copts = ["-Wall"] + tflite_copts()
|
||||||
|
|
||||||
cc_library(
|
|
||||||
name = "logging",
|
|
||||||
hdrs = ["logging.h"],
|
|
||||||
copts = common_copts,
|
|
||||||
deps = [
|
|
||||||
"//tensorflow/lite/tools:logging",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
cc_binary(
|
cc_binary(
|
||||||
name = "benchmark_model",
|
name = "benchmark_model",
|
||||||
srcs = [
|
srcs = [
|
||||||
@ -39,7 +28,7 @@ cc_binary(
|
|||||||
tags = ["builder_default_android_arm64"],
|
tags = ["builder_default_android_arm64"],
|
||||||
deps = [
|
deps = [
|
||||||
":benchmark_tflite_model_lib",
|
":benchmark_tflite_model_lib",
|
||||||
":logging",
|
"//tensorflow/lite/tools:logging",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -60,7 +49,7 @@ cc_binary(
|
|||||||
deps = [
|
deps = [
|
||||||
":benchmark_performance_options",
|
":benchmark_performance_options",
|
||||||
":benchmark_tflite_model_lib",
|
":benchmark_tflite_model_lib",
|
||||||
":logging",
|
"//tensorflow/lite/tools:logging",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -83,9 +72,9 @@ tf_cc_binary(
|
|||||||
}),
|
}),
|
||||||
deps = [
|
deps = [
|
||||||
":benchmark_tflite_model_lib",
|
":benchmark_tflite_model_lib",
|
||||||
":logging",
|
|
||||||
"//tensorflow/lite/delegates/flex:delegate",
|
"//tensorflow/lite/delegates/flex:delegate",
|
||||||
"//tensorflow/lite/testing:init_tensorflow",
|
"//tensorflow/lite/testing:init_tensorflow",
|
||||||
|
"//tensorflow/lite/tools:logging",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -110,11 +99,11 @@ cc_test(
|
|||||||
":benchmark_performance_options",
|
":benchmark_performance_options",
|
||||||
":benchmark_tflite_model_lib",
|
":benchmark_tflite_model_lib",
|
||||||
":delegate_provider_hdr",
|
":delegate_provider_hdr",
|
||||||
":logging",
|
|
||||||
"//tensorflow/lite:framework",
|
"//tensorflow/lite:framework",
|
||||||
"//tensorflow/lite:string_util",
|
"//tensorflow/lite:string_util",
|
||||||
"//tensorflow/lite/testing:util",
|
"//tensorflow/lite/testing:util",
|
||||||
"//tensorflow/lite/tools:command_line_flags",
|
"//tensorflow/lite/tools:command_line_flags",
|
||||||
|
"//tensorflow/lite/tools:logging",
|
||||||
"@com_google_absl//absl/algorithm",
|
"@com_google_absl//absl/algorithm",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
"@com_google_absl//absl/strings:str_format",
|
"@com_google_absl//absl/strings:str_format",
|
||||||
@ -151,7 +140,6 @@ cc_library(
|
|||||||
":benchmark_utils",
|
":benchmark_utils",
|
||||||
":coreml_delegate_provider",
|
":coreml_delegate_provider",
|
||||||
":delegate_provider_hdr",
|
":delegate_provider_hdr",
|
||||||
":logging",
|
|
||||||
":profiling_listener",
|
":profiling_listener",
|
||||||
":tflite_execution_providers",
|
":tflite_execution_providers",
|
||||||
"//tensorflow/lite:framework",
|
"//tensorflow/lite:framework",
|
||||||
@ -160,6 +148,7 @@ cc_library(
|
|||||||
"//tensorflow/lite/profiling:platform_profiler",
|
"//tensorflow/lite/profiling:platform_profiler",
|
||||||
"//tensorflow/lite/profiling:profile_summary_formatter",
|
"//tensorflow/lite/profiling:profile_summary_formatter",
|
||||||
"//tensorflow/lite/profiling:profiler",
|
"//tensorflow/lite/profiling:profiler",
|
||||||
|
"//tensorflow/lite/tools:logging",
|
||||||
"//tensorflow/lite/tools/evaluation:utils",
|
"//tensorflow/lite/tools/evaluation:utils",
|
||||||
"@com_google_absl//absl/base:core_headers",
|
"@com_google_absl//absl/base:core_headers",
|
||||||
"@com_google_absl//absl/strings",
|
"@com_google_absl//absl/strings",
|
||||||
@ -178,7 +167,7 @@ cc_library(
|
|||||||
":benchmark_model_lib",
|
":benchmark_model_lib",
|
||||||
":benchmark_params",
|
":benchmark_params",
|
||||||
":benchmark_utils",
|
":benchmark_utils",
|
||||||
":logging",
|
"//tensorflow/lite/tools:logging",
|
||||||
"@com_google_absl//absl/memory",
|
"@com_google_absl//absl/memory",
|
||||||
"//tensorflow/core/util:stats_calculator_portable",
|
"//tensorflow/core/util:stats_calculator_portable",
|
||||||
"//tensorflow/lite/c:common",
|
"//tensorflow/lite/c:common",
|
||||||
@ -210,13 +199,13 @@ cc_library(
|
|||||||
deps = [
|
deps = [
|
||||||
":benchmark_params",
|
":benchmark_params",
|
||||||
":benchmark_utils",
|
":benchmark_utils",
|
||||||
":logging",
|
|
||||||
"//tensorflow/core/util:stats_calculator_portable",
|
"//tensorflow/core/util:stats_calculator_portable",
|
||||||
"//tensorflow/lite:framework",
|
"//tensorflow/lite:framework",
|
||||||
"//tensorflow/lite/c:common",
|
"//tensorflow/lite/c:common",
|
||||||
"//tensorflow/lite/profiling:memory_info",
|
"//tensorflow/lite/profiling:memory_info",
|
||||||
"//tensorflow/lite/profiling:time",
|
"//tensorflow/lite/profiling:time",
|
||||||
"//tensorflow/lite/tools:command_line_flags",
|
"//tensorflow/lite/tools:command_line_flags",
|
||||||
|
"//tensorflow/lite/tools:logging",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -230,7 +219,7 @@ cc_library(
|
|||||||
":benchmark_params",
|
":benchmark_params",
|
||||||
"//tensorflow/lite/c:common",
|
"//tensorflow/lite/c:common",
|
||||||
"//tensorflow/lite/tools:command_line_flags",
|
"//tensorflow/lite/tools:command_line_flags",
|
||||||
"//tensorflow/lite/tools/benchmark:logging",
|
"//tensorflow/lite/tools:logging",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -322,10 +311,7 @@ cc_library(
|
|||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
deps = [
|
deps = [
|
||||||
":benchmark_model_lib",
|
|
||||||
":benchmark_params",
|
|
||||||
":delegate_provider_hdr",
|
":delegate_provider_hdr",
|
||||||
":logging",
|
|
||||||
"//tensorflow/lite/tools/evaluation:utils",
|
"//tensorflow/lite/tools/evaluation:utils",
|
||||||
] + select({
|
] + select({
|
||||||
"//tensorflow:ios": [
|
"//tensorflow:ios": [
|
||||||
|
@ -35,7 +35,6 @@ tflite_jni_binary(
|
|||||||
deps = [
|
deps = [
|
||||||
"//tensorflow/lite/java/jni",
|
"//tensorflow/lite/java/jni",
|
||||||
"//tensorflow/lite/tools/benchmark:benchmark_tflite_model_lib",
|
"//tensorflow/lite/tools/benchmark:benchmark_tflite_model_lib",
|
||||||
"//tensorflow/lite/tools/benchmark:logging",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ limitations under the License.
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
#include <android/log.h>
|
#include <android/log.h>
|
||||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace benchmark {
|
namespace benchmark {
|
||||||
|
@ -21,7 +21,7 @@ limitations under the License.
|
|||||||
#include "tensorflow/lite/profiling/memory_info.h"
|
#include "tensorflow/lite/profiling/memory_info.h"
|
||||||
#include "tensorflow/lite/profiling/time.h"
|
#include "tensorflow/lite/profiling/time.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_utils.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_utils.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace benchmark {
|
namespace benchmark {
|
||||||
|
@ -30,8 +30,8 @@ limitations under the License.
|
|||||||
#include "tensorflow/lite/profiling/time.h"
|
#include "tensorflow/lite/profiling/time.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_params.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_params.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_utils.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_utils.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
|
||||||
#include "tensorflow/lite/tools/command_line_flags.h"
|
#include "tensorflow/lite/tools/command_line_flags.h"
|
||||||
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
#if (defined(ANDROID) || defined(__ANDROID__)) && \
|
#if (defined(ANDROID) || defined(__ANDROID__)) && \
|
||||||
(defined(__arm__) || defined(__aarch64__))
|
(defined(__arm__) || defined(__aarch64__))
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "tensorflow/lite/testing/init_tensorflow.h"
|
#include "tensorflow/lite/testing/init_tensorflow.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace benchmark {
|
namespace benchmark {
|
||||||
|
@ -28,8 +28,8 @@ limitations under the License.
|
|||||||
#include "tensorflow/lite/tools/benchmark/benchmark_performance_options.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_performance_options.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/delegate_provider.h"
|
#include "tensorflow/lite/tools/benchmark/delegate_provider.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
|
||||||
#include "tensorflow/lite/tools/command_line_flags.h"
|
#include "tensorflow/lite/tools/command_line_flags.h"
|
||||||
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const std::string* g_fp32_model_path = nullptr;
|
const std::string* g_fp32_model_path = nullptr;
|
||||||
|
@ -37,8 +37,8 @@ limitations under the License.
|
|||||||
#include "tensorflow/lite/string_util.h"
|
#include "tensorflow/lite/string_util.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_utils.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_utils.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/delegate_provider.h"
|
#include "tensorflow/lite/tools/benchmark/delegate_provider.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
|
||||||
#include "tensorflow/lite/tools/benchmark/profiling_listener.h"
|
#include "tensorflow/lite/tools/benchmark/profiling_listener.h"
|
||||||
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
void RegisterSelectedOps(::tflite::MutableOpResolver* resolver);
|
void RegisterSelectedOps(::tflite::MutableOpResolver* resolver);
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ constexpr int kOpProfilingEnabledDefault = false;
|
|||||||
class PlatformProfilingListener : public BenchmarkListener {
|
class PlatformProfilingListener : public BenchmarkListener {
|
||||||
public:
|
public:
|
||||||
explicit PlatformProfilingListener(Interpreter* interpreter) {
|
explicit PlatformProfilingListener(Interpreter* interpreter) {
|
||||||
TFLITE_BENCHMARK_CHECK(interpreter);
|
TFLITE_TOOLS_CHECK(interpreter);
|
||||||
platform_profiler_ = profiling::CreatePlatformProfiler();
|
platform_profiler_ = profiling::CreatePlatformProfiler();
|
||||||
interpreter->SetProfiler(platform_profiler_.get());
|
interpreter->SetProfiler(platform_profiler_.get());
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ TfLiteStatus PopulateInputLayerInfo(
|
|||||||
|
|
||||||
input.name = names[i];
|
input.name = names[i];
|
||||||
|
|
||||||
TFLITE_BENCHMARK_CHECK(util::SplitAndParse(shapes[i], ',', &input.shape))
|
TFLITE_TOOLS_CHECK(util::SplitAndParse(shapes[i], ',', &input.shape))
|
||||||
<< "Incorrect size string specified: " << shapes[i];
|
<< "Incorrect size string specified: " << shapes[i];
|
||||||
for (int dim : input.shape) {
|
for (int dim : input.shape) {
|
||||||
if (dim == -1) {
|
if (dim == -1) {
|
||||||
@ -392,7 +392,7 @@ TfLiteStatus BenchmarkTfLiteModel::ValidateParams() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint64_t BenchmarkTfLiteModel::ComputeInputBytes() {
|
uint64_t BenchmarkTfLiteModel::ComputeInputBytes() {
|
||||||
TFLITE_BENCHMARK_CHECK(interpreter_);
|
TFLITE_TOOLS_CHECK(interpreter_);
|
||||||
uint64_t total_input_bytes = 0;
|
uint64_t total_input_bytes = 0;
|
||||||
for (int input : interpreter_->inputs()) {
|
for (int input : interpreter_->inputs()) {
|
||||||
auto* t = interpreter_->tensor(input);
|
auto* t = interpreter_->tensor(input);
|
||||||
@ -652,7 +652,7 @@ TfLiteStatus BenchmarkTfLiteModel::Init() {
|
|||||||
auto interpreter_inputs = interpreter_->inputs();
|
auto interpreter_inputs = interpreter_->inputs();
|
||||||
|
|
||||||
if (!inputs_.empty()) {
|
if (!inputs_.empty()) {
|
||||||
TFLITE_BENCHMARK_CHECK_EQ(inputs_.size(), interpreter_inputs.size())
|
TFLITE_TOOLS_CHECK_EQ(inputs_.size(), interpreter_inputs.size())
|
||||||
<< "Inputs mismatch: Model inputs #:" << inputs_.size()
|
<< "Inputs mismatch: Model inputs #:" << inputs_.size()
|
||||||
<< " expected: " << interpreter_inputs.size();
|
<< " expected: " << interpreter_inputs.size();
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_performance_options.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_performance_options.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace benchmark {
|
namespace benchmark {
|
||||||
|
@ -21,8 +21,8 @@ limitations under the License.
|
|||||||
|
|
||||||
#include "tensorflow/lite/c/common.h"
|
#include "tensorflow/lite/c/common.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/benchmark_params.h"
|
#include "tensorflow/lite/tools/benchmark/benchmark_params.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
|
||||||
#include "tensorflow/lite/tools/command_line_flags.h"
|
#include "tensorflow/lite/tools/command_line_flags.h"
|
||||||
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
|
|
||||||
namespace tflite {
|
namespace tflite {
|
||||||
namespace benchmark {
|
namespace benchmark {
|
||||||
|
@ -11,7 +11,7 @@ package(
|
|||||||
ios_static_framework(
|
ios_static_framework(
|
||||||
name = "TensorFlowLiteBenchmarkC_framework",
|
name = "TensorFlowLiteBenchmarkC_framework",
|
||||||
hdrs = [
|
hdrs = [
|
||||||
"//tensorflow/lite/tools/benchmark:logging.h",
|
"//tensorflow/lite/tools:logging.h",
|
||||||
"//tensorflow/lite/tools/benchmark/experimental/c:benchmark_c_api.h",
|
"//tensorflow/lite/tools/benchmark/experimental/c:benchmark_c_api.h",
|
||||||
"//tensorflow/lite/tools/benchmark/experimental/c:c_api_types.h",
|
"//tensorflow/lite/tools/benchmark/experimental/c:c_api_types.h",
|
||||||
],
|
],
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#if defined(USE_TFLITE_BENCHMARK_HEADERS)
|
#if defined(USE_TFLITE_BENCHMARK_HEADERS)
|
||||||
#include "tensorflow/lite/tools/benchmark/experimental/c/benchmark_c_api.h"
|
#include "tensorflow/lite/tools/benchmark/experimental/c/benchmark_c_api.h"
|
||||||
#include "tensorflow/lite/tools/benchmark/logging.h"
|
#include "tensorflow/lite/tools/logging.h"
|
||||||
#else
|
#else
|
||||||
#import <TensorFlowLiteBenchmarkC/TensorFlowLiteBenchmarkC.h>
|
#import <TensorFlowLiteBenchmarkC/TensorFlowLiteBenchmarkC.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
/* Copyright 2018 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.
|
|
||||||
==============================================================================*/
|
|
||||||
|
|
||||||
#ifndef TENSORFLOW_LITE_TOOLS_BENCHMARK_LOGGING_H_
|
|
||||||
#define TENSORFLOW_LITE_TOOLS_BENCHMARK_LOGGING_H_
|
|
||||||
|
|
||||||
// TODO(b/149482807): completely remove this file from the code base.
|
|
||||||
#include "tensorflow/lite/tools/logging.h"
|
|
||||||
|
|
||||||
#define TFLITE_BENCHMARK_CHECK(condition) TFLITE_TOOLS_CHECK(condition)
|
|
||||||
#define TFLITE_BENCHMARK_CHECK_EQ(a, b) TFLITE_TOOLS_CHECK(a == b)
|
|
||||||
|
|
||||||
#endif // TENSORFLOW_LITE_TOOLS_BENCHMARK_LOGGING_H_
|
|
Loading…
x
Reference in New Issue
Block a user