From 8eef2a47b7cf7f3590f51bdd0da3c66bb7081760 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Senior=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Thu, 29 Mar 2018 08:47:10 +0900 Subject: [PATCH] Do measure tensor update/extraction time (#279) This commit revises tflite_run not to measure tensor setting & extraction time (for Invoke). Signed-off-by: Jonghyun Park --- tools/tflite_run/src/tflite_run.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/tflite_run/src/tflite_run.cc b/tools/tflite_run/src/tflite_run.cc index fd932dc..26eb30b 100644 --- a/tools/tflite_run/src/tflite_run.cc +++ b/tools/tflite_run/src/tflite_run.cc @@ -124,7 +124,8 @@ int main(const int argc, char **argv) assert(status == kTfLiteOk); }; - t_invoke.measure() << [&status, &interpreter, &image](void) + // NOTE Block is introduced to minimize code diff + // TODO Reduce nesting level { std::cout << "input tensor indices = ["; @@ -136,10 +137,17 @@ int main(const int argc, char **argv) for( const auto& o : interpreter->inputs() ) { image.AssignTensor(interpreter->tensor(o)); } + } + t_invoke.measure() << [&status, &interpreter, &image](void) + { status = interpreter->Invoke(); assert(status == kTfLiteOk); + }; + // NOTE Block is introduced to minimize code diff + // TODO Reduce nesting level + { std::cout << "output tensor indices = ["; for( const auto& o : interpreter->outputs() ) { std::cout << o << "("; @@ -150,7 +158,7 @@ int main(const int argc, char **argv) } std::cout << "]" << std::endl; - }; + } std::cout << "Prepare takes " << t_prepare.count() << " seconds" << std::endl; std::cout << "Invoke takes " << t_invoke.count() << " seconds" << std::endl; -- 2.7.4