diff options
author | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2018-11-01 16:15:57 +0000 |
---|---|---|
committer | Aron Virginas-Tar <Aron.Virginas-Tar@arm.com> | 2018-11-02 14:49:21 +0000 |
commit | c9cc80455ff29fd2c8622c9487ec9c57ade6ea30 (patch) | |
tree | 41b1491312fe6082b39d5d37ffa0dcf0ab0f2817 /src/backends/test/QuantizeHelper.hpp | |
parent | 207ef9a6b8b3ea0afe9a095639f67b5dedd095d7 (diff) | |
download | armnn-c9cc80455ff29fd2c8622c9487ec9c57ade6ea30.tar.gz |
IVGCVSW-1946: Remove armnn/src from the include paths
Change-Id: I663a0a0fccb43ee960ec070121a59df9db0bb04e
Diffstat (limited to 'src/backends/test/QuantizeHelper.hpp')
-rw-r--r-- | src/backends/test/QuantizeHelper.hpp | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/src/backends/test/QuantizeHelper.hpp b/src/backends/test/QuantizeHelper.hpp deleted file mode 100644 index bb4e561d59..0000000000 --- a/src/backends/test/QuantizeHelper.hpp +++ /dev/null @@ -1,91 +0,0 @@ -// -// Copyright © 2017 Arm Ltd. All rights reserved. -// SPDX-License-Identifier: MIT -// -#pragma once - -#include <armnn/ArmNN.hpp> -#include <armnn/TypesUtils.hpp> - -#include <initializer_list> -#include <iterator> -#include <vector> -#include <boost/core/ignore_unused.hpp> - -template<typename T, bool DoQuantize=true> -struct SelectiveQuantizer -{ - static T Quantize(float value, float scale, int32_t offset) - { - return armnn::Quantize<T>(value, scale, offset); - } - - static float Dequantize(T value, float scale, int32_t offset) - { - return armnn::Dequantize(value, scale, offset); - } -}; - -template<typename T> -struct SelectiveQuantizer<T, false> -{ - static T Quantize(float value, float scale, int32_t offset) - { - boost::ignore_unused(scale, offset); - return value; - } - - static float Dequantize(T value, float scale, int32_t offset) - { - boost::ignore_unused(scale, offset); - return value; - } -}; - -template<typename T> -T SelectiveQuantize(float value, float scale, int32_t offset) -{ - return SelectiveQuantizer<T, armnn::IsQuantizedType<T>()>::Quantize(value, scale, offset); -}; - -template<typename T> -float SelectiveDequantize(T value, float scale, int32_t offset) -{ - return SelectiveQuantizer<T, armnn::IsQuantizedType<T>()>::Dequantize(value, scale, offset); -}; - -template<typename ItType> -struct IsFloatingPointIterator -{ - static constexpr bool value=std::is_floating_point<typename std::iterator_traits<ItType>::value_type>::value; -}; - -template <typename T, typename FloatIt, -typename std::enable_if<IsFloatingPointIterator<FloatIt>::value, int>::type=0 // Makes sure fp iterator is valid. -> -std::vector<T> QuantizedVector(float qScale, int32_t qOffset, FloatIt first, FloatIt last) -{ - std::vector<T> quantized; - quantized.reserve(boost::numeric_cast<size_t>(std::distance(first, last))); - - for (auto it = first; it != last; ++it) - { - auto f = *it; - T q =SelectiveQuantize<T>(f, qScale, qOffset); - quantized.push_back(q); - } - - return quantized; -} - -template<typename T> -std::vector<T> QuantizedVector(float qScale, int32_t qOffset, const std::vector<float>& array) -{ - return QuantizedVector<T>(qScale, qOffset, array.begin(), array.end()); -} - -template<typename T> -std::vector<T> QuantizedVector(float qScale, int32_t qOffset, std::initializer_list<float> array) -{ - return QuantizedVector<T>(qScale, qOffset, array.begin(), array.end()); -} |