Skip to content

Commit

Permalink
Avoid depending on init_tensorflow in benchmark_main.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 217145701
  • Loading branch information
tensorflower-gardener committed Oct 15, 2018
1 parent 55e97b3 commit 61081e2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tensorflow/contrib/lite/tools/benchmark/BUILD
Expand Up @@ -39,7 +39,7 @@ cc_binary(
cc_binary(
name = "benchmark_model_plus_flex",
srcs = [
"benchmark_main.cc",
"benchmark_plus_flex_main.cc",
],
copts = common_copts,
linkopts = tflite_linkopts() + select({
Expand Down
2 changes: 0 additions & 2 deletions tensorflow/contrib/lite/tools/benchmark/benchmark_main.cc
Expand Up @@ -13,15 +13,13 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#include "tensorflow/contrib/lite/testing/init_tensorflow.h"
#include "tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h"
#include "tensorflow/contrib/lite/tools/benchmark/logging.h"

namespace tflite {
namespace benchmark {

int Main(int argc, char** argv) {
::tflite::InitTensorFlow();
#ifdef TFLITE_CUSTOM_OPS_HEADER
TFLITE_LOG(INFO) << "STARTING with custom ops!";
#else
Expand Down
@@ -0,0 +1,39 @@
/* 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.
==============================================================================*/

#include "tensorflow/contrib/lite/testing/init_tensorflow.h"
#include "tensorflow/contrib/lite/tools/benchmark/benchmark_tflite_model.h"
#include "tensorflow/contrib/lite/tools/benchmark/logging.h"

namespace tflite {
namespace benchmark {

int Main(int argc, char** argv) {
::tflite::InitTensorFlow();
#ifdef TFLITE_CUSTOM_OPS_HEADER
TFLITE_LOG(INFO) << "STARTING with custom ops!";
#else
TFLITE_LOG(INFO) << "STARTING!";
#endif
BenchmarkTfLiteModel benchmark;
BenchmarkLoggingListener listener;
benchmark.AddListener(&listener);
benchmark.Run(argc, argv);
return 0;
}
} // namespace benchmark
} // namespace tflite

int main(int argc, char** argv) { return tflite::benchmark::Main(argc, argv); }

0 comments on commit 61081e2

Please sign in to comment.