From 0b3d7fdb6b196a864122df59d18bcab13ffe00c1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=98=A4=ED=98=95=EC=84=9D/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 16 May 2019 14:03:06 +0900 Subject: [PATCH] Use template for actvation calculation (#5198) Change activation implementation to use template Prepare to support more type (int32, uint32, etc) Signed-off-by: Hyeongseok Oh --- libs/cker/include/cker/Utils.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/cker/include/cker/Utils.h b/libs/cker/include/cker/Utils.h index 6734239..84bbbc3 100644 --- a/libs/cker/include/cker/Utils.h +++ b/libs/cker/include/cker/Utils.h @@ -28,10 +28,10 @@ namespace nnfw namespace cker { -inline float ActivationFunctionWithMinMax(float x, float output_activation_min, - float output_activation_max) +template +inline T ActivationFunctionWithMinMax(T x, T output_activation_min, T output_activation_max) { - return std::min(std::max(x, output_activation_min), output_activation_max); + return std::min(std::max(x, output_activation_min), output_activation_max); } inline int32_t MultiplyByQuantizedMultiplier(int32_t x, int32_t quantized_multiplier, int shift) -- 2.7.4