aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/examples
diff options
context:
space:
mode:
authorGravatar Yifei Feng <yifeif@google.com>2018-05-15 10:58:43 -0700
committerGravatar Yifei Feng <yifeif@google.com>2018-05-15 10:58:43 -0700
commit41ed2381d9d958abf6c93eb8e49e88282a5099ae (patch)
tree03142a327497f65199f8c9ae86062de1ce1c1e71 /tensorflow/contrib/lite/examples
parentde4a6e646be56ca59c78dd6f92f8f6bcc7196696 (diff)
parenta7a3bb3df12c632b81bf1b23f8405f92a0c903c3 (diff)
Merge commit for internal changes
Diffstat (limited to 'tensorflow/contrib/lite/examples')
-rw-r--r--tensorflow/contrib/lite/examples/ios/camera/CameraExampleViewController.mm2
-rw-r--r--tensorflow/contrib/lite/examples/ios/simple/RunModelViewController.mm2
-rw-r--r--tensorflow/contrib/lite/examples/label_image/bitmap_helpers_impl.h4
-rw-r--r--tensorflow/contrib/lite/examples/label_image/label_image.cc50
4 files changed, 28 insertions, 30 deletions
diff --git a/tensorflow/contrib/lite/examples/ios/camera/CameraExampleViewController.mm b/tensorflow/contrib/lite/examples/ios/camera/CameraExampleViewController.mm
index d74e275f04..59b575ab6e 100644
--- a/tensorflow/contrib/lite/examples/ios/camera/CameraExampleViewController.mm
+++ b/tensorflow/contrib/lite/examples/ios/camera/CameraExampleViewController.mm
@@ -25,8 +25,8 @@
#include "tensorflow/contrib/lite/kernels/register.h"
#include "tensorflow/contrib/lite/model.h"
+#include "tensorflow/contrib/lite/op_resolver.h"
#include "tensorflow/contrib/lite/string_util.h"
-#include "tensorflow/contrib/lite/tools/mutable_op_resolver.h"
#define LOG(x) std::cerr
diff --git a/tensorflow/contrib/lite/examples/ios/simple/RunModelViewController.mm b/tensorflow/contrib/lite/examples/ios/simple/RunModelViewController.mm
index 0ab7aa25d0..32da7f7e4f 100644
--- a/tensorflow/contrib/lite/examples/ios/simple/RunModelViewController.mm
+++ b/tensorflow/contrib/lite/examples/ios/simple/RunModelViewController.mm
@@ -24,8 +24,8 @@
#include "tensorflow/contrib/lite/kernels/register.h"
#include "tensorflow/contrib/lite/model.h"
+#include "tensorflow/contrib/lite/op_resolver.h"
#include "tensorflow/contrib/lite/string_util.h"
-#include "tensorflow/contrib/lite/tools/mutable_op_resolver.h"
#include "ios_image_load.h"
diff --git a/tensorflow/contrib/lite/examples/label_image/bitmap_helpers_impl.h b/tensorflow/contrib/lite/examples/label_image/bitmap_helpers_impl.h
index 2a64c1de72..e36218e4f1 100644
--- a/tensorflow/contrib/lite/examples/label_image/bitmap_helpers_impl.h
+++ b/tensorflow/contrib/lite/examples/label_image/bitmap_helpers_impl.h
@@ -62,8 +62,8 @@ void resize(T* out, uint8_t* in, int image_height, int image_width,
{1, wanted_height, wanted_width, wanted_channels}, quant);
ops::builtin::BuiltinOpResolver resolver;
- TfLiteRegistration* resize_op =
- resolver.FindOp(BuiltinOperator_RESIZE_BILINEAR);
+ const TfLiteRegistration* resize_op =
+ resolver.FindOp(BuiltinOperator_RESIZE_BILINEAR, 1);
auto* params = reinterpret_cast<TfLiteResizeBilinearParams*>(
malloc(sizeof(TfLiteResizeBilinearParams)));
params->align_corners = false;
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 '?':