From e3848c5c5e7f536ff7b07401dfd96f95f3e042f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=82=A8=EA=B6=81=EC=84=9D/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 8 Oct 2019 10:55:12 +0900 Subject: [PATCH] [exo-tflite] Introduce locoex::FusedActFunc converter (#7964) This commit will introduce `locoex::FusedActFunc` converter, to return `tflite::ActivationFunctionType` Signed-off-by: Seok NamKoong --- compiler/exo-tflite/src/ExporterUtils.cpp | 20 ++++++++++++++++++++ compiler/exo-tflite/src/ExporterUtils.h | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/compiler/exo-tflite/src/ExporterUtils.cpp b/compiler/exo-tflite/src/ExporterUtils.cpp index a448be6..e7cdc4a 100644 --- a/compiler/exo-tflite/src/ExporterUtils.cpp +++ b/compiler/exo-tflite/src/ExporterUtils.cpp @@ -21,6 +21,26 @@ namespace exo { +tflite::ActivationFunctionType to_tflite_actfunc(locoex::FusedActFunc func) +{ + switch (func) + { + case locoex::FusedActFunc::NONE: + return tflite::ActivationFunctionType_NONE; + case locoex::FusedActFunc::RELU: + return tflite::ActivationFunctionType_RELU; + case locoex::FusedActFunc::RELU6: + return tflite::ActivationFunctionType_RELU6; + default: + throw std::runtime_error("Not supported locoex FusedActFunc Type"); + } +} + +} // namespace exo + +namespace exo +{ + ShapeDescription to_shape_description(const loco::TensorShape &shape) { ShapeDescription res; diff --git a/compiler/exo-tflite/src/ExporterUtils.h b/compiler/exo-tflite/src/ExporterUtils.h index 62a77f9..9eda12e 100644 --- a/compiler/exo-tflite/src/ExporterUtils.h +++ b/compiler/exo-tflite/src/ExporterUtils.h @@ -39,6 +39,13 @@ struct OpCode } // namespace exo +namespace exo +{ + +tflite::ActivationFunctionType to_tflite_actfunc(locoex::FusedActFunc func); + +} // namespace exo + namespace std { -- 2.7.4