aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/examples
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-05-14 13:22:09 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-14 13:24:44 -0700
commite528e5ab82fafe1cf8f5d69f9b18426af1b51d09 (patch)
treea11cd9acc45963e941a213a80825e71b4b92a902 /tensorflow/contrib/lite/examples
parent8f4618d7fc30e04a97664b87bc73d97af6389e34 (diff)
Various ClangTidy-inspired fixes.
PiperOrigin-RevId: 196556727
Diffstat (limited to 'tensorflow/contrib/lite/examples')
-rw-r--r--tensorflow/contrib/lite/examples/label_image/label_image.cc50
1 files changed, 24 insertions, 26 deletions
diff --git a/tensorflow/contrib/lite/examples/label_image/label_image.cc b/tensorflow/contrib/lite/examples/label_image/label_image.cc
index 456c5c6dc7..966fcd2a31 100644
--- a/tensorflow/contrib/lite/examples/label_image/label_image.cc
+++ b/tensorflow/contrib/lite/examples/label_image/label_image.cc
@@ -77,14 +77,13 @@ void PrintProfilingInfo(const profiling::ProfileEvent* e, uint32_t op_index,
// time (ms) , Node xxx, OpCode xxx, symblic name
// 5.352, Node 5, OpCode 4, DEPTHWISE_CONV_2D
-
LOG(INFO) << std::fixed << std::setw(10) << std::setprecision(3)
<< (e->end_timestamp_us - e->begin_timestamp_us) / 1000.0
<< ", Node " << std::setw(3) << std::setprecision(3) << op_index
<< ", OpCode " << std::setw(3) << std::setprecision(3)
<< registration.builtin_code << ", "
<< EnumNameBuiltinOperator(
- (BuiltinOperator)registration.builtin_code)
+ static_cast<BuiltinOperator>(registration.builtin_code))
<< "\n";
}
@@ -190,13 +189,13 @@ void RunInference(Settings* s) {
if (s->profiling) profiler->StartProfiling();
struct timeval start_time, stop_time;
- gettimeofday(&start_time, NULL);
+ gettimeofday(&start_time, nullptr);
for (int i = 0; i < s->loop_count; i++) {
if (interpreter->Invoke() != kTfLiteOk) {
LOG(FATAL) << "Failed to invoke tflite!\n";
}
}
- gettimeofday(&stop_time, NULL);
+ gettimeofday(&stop_time, nullptr);
LOG(INFO) << "invoked \n";
LOG(INFO) << "average time: "
<< (get_us(stop_time) - get_us(start_time)) / (s->loop_count * 1000)
@@ -271,17 +270,17 @@ int Main(int argc, char** argv) {
int c;
while (1) {
static struct option long_options[] = {
- {"accelerated", required_argument, 0, 'a'},
- {"count", required_argument, 0, 'c'},
- {"verbose", required_argument, 0, 'v'},
- {"image", required_argument, 0, 'i'},
- {"labels", required_argument, 0, 'l'},
- {"tflite_model", required_argument, 0, 'm'},
- {"profiling", required_argument, 0, 'p'},
- {"threads", required_argument, 0, 't'},
- {"input_mean", required_argument, 0, 'b'},
- {"input_std", required_argument, 0, 's'},
- {0, 0, 0, 0}};
+ {"accelerated", required_argument, nullptr, 'a'},
+ {"count", required_argument, nullptr, 'c'},
+ {"verbose", required_argument, nullptr, 'v'},
+ {"image", required_argument, nullptr, 'i'},
+ {"labels", required_argument, nullptr, 'l'},
+ {"tflite_model", required_argument, nullptr, 'm'},
+ {"profiling", required_argument, nullptr, 'p'},
+ {"threads", required_argument, nullptr, 't'},
+ {"input_mean", required_argument, nullptr, 'b'},
+ {"input_std", required_argument, nullptr, 's'},
+ {nullptr, 0, nullptr, 0}};
/* getopt_long stores the option index here. */
int option_index = 0;
@@ -294,15 +293,14 @@ int Main(int argc, char** argv) {
switch (c) {
case 'a':
- s.accel = strtol( // NOLINT(runtime/deprecated_fn)
- optarg, (char**)NULL, 10);
+ s.accel = strtol(optarg, nullptr, 10); // NOLINT(runtime/deprecated_fn)
break;
case 'b':
- s.input_mean = strtod(optarg, NULL);
+ s.input_mean = strtod(optarg, nullptr);
break;
case 'c':
- s.loop_count = strtol( // NOLINT(runtime/deprecated_fn)
- optarg, (char**)NULL, 10);
+ s.loop_count =
+ strtol(optarg, nullptr, 10); // NOLINT(runtime/deprecated_fn)
break;
case 'i':
s.input_bmp_name = optarg;
@@ -314,19 +312,19 @@ int Main(int argc, char** argv) {
s.model_name = optarg;
break;
case 'p':
- s.profiling = strtol( // NOLINT(runtime/deprecated_fn)
- optarg, (char**)NULL, 10);
+ s.profiling =
+ strtol(optarg, nullptr, 10); // NOLINT(runtime/deprecated_fn)
break;
case 's':
- s.input_std = strtod(optarg, NULL);
+ s.input_std = strtod(optarg, nullptr);
break;
case 't':
s.number_of_threads = strtol( // NOLINT(runtime/deprecated_fn)
- optarg, (char**)NULL, 10);
+ optarg, nullptr, 10);
break;
case 'v':
- s.verbose = strtol( // NOLINT(runtime/deprecated_fn)
- optarg, (char**)NULL, 10);
+ s.verbose =
+ strtol(optarg, nullptr, 10); // NOLINT(runtime/deprecated_fn)
break;
case 'h':
case '?':