Remove tools/benchmark/logging.h and simply use tools/logging.h instead.

PiperOrigin-RevId: 306358463
Change-Id: I0aef70e0beb29a7de0434f3ef2a9e966aefaa87d
This commit is contained in:
Chao Mei 2020-04-13 19:15:28 -07:00 committed by TensorFlower Gardener
parent ec7d51c3bf
commit 43f67e0881
15 changed files with 24 additions and 63 deletions

View File

@ -9,6 +9,8 @@ package(
licenses = ["notice"], # Apache 2.0
)
exports_files(["logging.h"])
common_copts = ["-Wall"]
py_binary(

View File

@ -9,19 +9,8 @@ package(
licenses = ["notice"], # Apache 2.0
)
exports_files(["logging.h"])
common_copts = ["-Wall"] + tflite_copts()
cc_library(
name = "logging",
hdrs = ["logging.h"],
copts = common_copts,
deps = [
"//tensorflow/lite/tools:logging",
],
)
cc_binary(
name = "benchmark_model",
srcs = [
@ -39,7 +28,7 @@ cc_binary(
tags = ["builder_default_android_arm64"],
deps = [
":benchmark_tflite_model_lib",
":logging",
"//tensorflow/lite/tools:logging",
],
)
@ -60,7 +49,7 @@ cc_binary(
deps = [
":benchmark_performance_options",
":benchmark_tflite_model_lib",
":logging",
"//tensorflow/lite/tools:logging",
],
)
@ -83,9 +72,9 @@ tf_cc_binary(
}),
deps = [
":benchmark_tflite_model_lib",
":logging",
"//tensorflow/lite/delegates/flex:delegate",
"//tensorflow/lite/testing:init_tensorflow",
"//tensorflow/lite/tools:logging",
],
)
@ -110,11 +99,11 @@ cc_test(
":benchmark_performance_options",
":benchmark_tflite_model_lib",
":delegate_provider_hdr",
":logging",
"//tensorflow/lite:framework",
"//tensorflow/lite:string_util",
"//tensorflow/lite/testing:util",
"//tensorflow/lite/tools:command_line_flags",
"//tensorflow/lite/tools:logging",
"@com_google_absl//absl/algorithm",
"@com_google_absl//absl/memory",
"@com_google_absl//absl/strings:str_format",
@ -151,7 +140,6 @@ cc_library(
":benchmark_utils",
":coreml_delegate_provider",
":delegate_provider_hdr",
":logging",
":profiling_listener",
":tflite_execution_providers",
"//tensorflow/lite:framework",
@ -160,6 +148,7 @@ cc_library(
"//tensorflow/lite/profiling:platform_profiler",
"//tensorflow/lite/profiling:profile_summary_formatter",
"//tensorflow/lite/profiling:profiler",
"//tensorflow/lite/tools:logging",
"//tensorflow/lite/tools/evaluation:utils",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/strings",
@ -178,7 +167,7 @@ cc_library(
":benchmark_model_lib",
":benchmark_params",
":benchmark_utils",
":logging",
"//tensorflow/lite/tools:logging",
"@com_google_absl//absl/memory",
"//tensorflow/core/util:stats_calculator_portable",
"//tensorflow/lite/c:common",
@ -210,13 +199,13 @@ cc_library(
deps = [
":benchmark_params",
":benchmark_utils",
":logging",
"//tensorflow/core/util:stats_calculator_portable",
"//tensorflow/lite:framework",
"//tensorflow/lite/c:common",
"//tensorflow/lite/profiling:memory_info",
"//tensorflow/lite/profiling:time",
"//tensorflow/lite/tools:command_line_flags",
"//tensorflow/lite/tools:logging",
],
)
@ -230,7 +219,7 @@ cc_library(
":benchmark_params",
"//tensorflow/lite/c:common",
"//tensorflow/lite/tools:command_line_flags",
"//tensorflow/lite/tools/benchmark:logging",
"//tensorflow/lite/tools:logging",
],
)
@ -322,10 +311,7 @@ cc_library(
"//conditions:default": [],
}),
deps = [
":benchmark_model_lib",
":benchmark_params",
":delegate_provider_hdr",
":logging",
"//tensorflow/lite/tools/evaluation:utils",
] + select({
"//tensorflow:ios": [

View File

@ -35,7 +35,6 @@ tflite_jni_binary(
deps = [
"//tensorflow/lite/java/jni",
"//tensorflow/lite/tools/benchmark:benchmark_tflite_model_lib",
"//tensorflow/lite/tools/benchmark:logging",
],
)

View File

@ -19,7 +19,6 @@ limitations under the License.
#include <string>
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
#include "tensorflow/lite/tools/benchmark/logging.h"
#ifdef __ANDROID__
#include <android/log.h>

View File

@ -16,7 +16,7 @@ limitations under the License.
#include <iostream>
#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 benchmark {

View File

@ -21,7 +21,7 @@ limitations under the License.
#include "tensorflow/lite/profiling/memory_info.h"
#include "tensorflow/lite/profiling/time.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 benchmark {

View File

@ -30,8 +30,8 @@ limitations under the License.
#include "tensorflow/lite/profiling/time.h"
#include "tensorflow/lite/tools/benchmark/benchmark_params.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/logging.h"
#if (defined(ANDROID) || defined(__ANDROID__)) && \
(defined(__arm__) || defined(__aarch64__))

View File

@ -15,7 +15,7 @@ limitations under the License.
#include "tensorflow/lite/testing/init_tensorflow.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 benchmark {

View File

@ -28,8 +28,8 @@ limitations under the License.
#include "tensorflow/lite/tools/benchmark/benchmark_performance_options.h"
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.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/logging.h"
namespace {
const std::string* g_fp32_model_path = nullptr;

View File

@ -37,8 +37,8 @@ limitations under the License.
#include "tensorflow/lite/string_util.h"
#include "tensorflow/lite/tools/benchmark/benchmark_utils.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/logging.h"
void RegisterSelectedOps(::tflite::MutableOpResolver* resolver);
@ -64,7 +64,7 @@ constexpr int kOpProfilingEnabledDefault = false;
class PlatformProfilingListener : public BenchmarkListener {
public:
explicit PlatformProfilingListener(Interpreter* interpreter) {
TFLITE_BENCHMARK_CHECK(interpreter);
TFLITE_TOOLS_CHECK(interpreter);
platform_profiler_ = profiling::CreatePlatformProfiler();
interpreter->SetProfiler(platform_profiler_.get());
}
@ -214,7 +214,7 @@ TfLiteStatus PopulateInputLayerInfo(
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];
for (int dim : input.shape) {
if (dim == -1) {
@ -392,7 +392,7 @@ TfLiteStatus BenchmarkTfLiteModel::ValidateParams() {
}
uint64_t BenchmarkTfLiteModel::ComputeInputBytes() {
TFLITE_BENCHMARK_CHECK(interpreter_);
TFLITE_TOOLS_CHECK(interpreter_);
uint64_t total_input_bytes = 0;
for (int input : interpreter_->inputs()) {
auto* t = interpreter_->tensor(input);
@ -652,7 +652,7 @@ TfLiteStatus BenchmarkTfLiteModel::Init() {
auto interpreter_inputs = interpreter_->inputs();
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()
<< " expected: " << interpreter_inputs.size();
}

View File

@ -15,7 +15,7 @@ limitations under the License.
#include "tensorflow/lite/tools/benchmark/benchmark_performance_options.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 benchmark {

View File

@ -21,8 +21,8 @@ limitations under the License.
#include "tensorflow/lite/c/common.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/logging.h"
namespace tflite {
namespace benchmark {

View File

@ -11,7 +11,7 @@ package(
ios_static_framework(
name = "TensorFlowLiteBenchmarkC_framework",
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:c_api_types.h",
],

View File

@ -21,7 +21,7 @@
#if defined(USE_TFLITE_BENCHMARK_HEADERS)
#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
#import <TensorFlowLiteBenchmarkC/TensorFlowLiteBenchmarkC.h>
#endif

View File

@ -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_