From d4f0fead9e014f14e1435281f91fc7a48d02d6a1 Mon Sep 17 00:00:00 2001 From: Aron Virginas-Tar Date: Tue, 9 Apr 2019 14:08:06 +0100 Subject: IVGCVSW-2947 Remove boost dependency from include/TypesUtils.hpp !android-nn-driver:968 Signed-off-by: Aron Virginas-Tar Change-Id: I03ccb4842b060a9893567542bfcadc180bbc7311 --- include/armnn/TypesUtils.hpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/armnn/TypesUtils.hpp b/include/armnn/TypesUtils.hpp index 4880c90538..837490d258 100644 --- a/include/armnn/TypesUtils.hpp +++ b/include/armnn/TypesUtils.hpp @@ -7,9 +7,6 @@ #include "Tensor.hpp" #include "Types.hpp" -#include -#include - #include #include #include @@ -191,20 +188,7 @@ inline std::ostream & operator<<(std::ostream & os, const armnn::TensorShape & s /// @return - The quantized value calculated as round(value/scale)+offset. /// template -inline QuantizedType Quantize(float value, float scale, int32_t offset) -{ - static_assert(IsQuantizedType(), "Not an integer type."); - constexpr QuantizedType max = std::numeric_limits::max(); - constexpr QuantizedType min = std::numeric_limits::lowest(); - BOOST_ASSERT(scale != 0.f); - BOOST_ASSERT(!std::isnan(value)); - - float clampedValue = std::min(std::max(static_cast(round(value/scale) + offset), static_cast(min)), - static_cast(max)); - auto quantizedBits = static_cast(clampedValue); - - return quantizedBits; -} +QuantizedType Quantize(float value, float scale, int32_t offset); /// Dequantize an 8-bit data type into a floating point data type. /// @param value - The value to dequantize. @@ -213,14 +197,7 @@ inline QuantizedType Quantize(float value, float scale, int32_t offset) /// @return - The dequantized value calculated as (value-offset)*scale. /// template -inline float Dequantize(QuantizedType value, float scale, int32_t offset) -{ - static_assert(IsQuantizedType(), "Not an integer type."); - BOOST_ASSERT(scale != 0.f); - BOOST_ASSERT(!std::isnan(value)); - float dequantized = boost::numeric_cast(value - offset) * scale; - return dequantized; -} +float Dequantize(QuantizedType value, float scale, int32_t offset); inline void VerifyTensorInfoDataType(const armnn::TensorInfo & info, armnn::DataType dataType) { -- cgit v1.2.1