15#include <initializer_list>
22template<
typename T,
bool DoQuantize=true>
25 static T
Quantize(
float value,
float scale, int32_t offset)
30 static float Dequantize(T value,
float scale, int32_t offset)
39 static T
Quantize(
float value,
float scale, int32_t offset)
45 static float Dequantize(T value,
float scale, int32_t offset)
96template<
typename ItType>
99 static constexpr bool value=std::is_floating_point<typename std::iterator_traits<ItType>::value_type>
::value;
102template <
typename T,
typename FloatIt,
103typename std::enable_if<IsFloatingPointIterator<FloatIt>::value,
int>::type=0
105std::vector<T>
QuantizedVector(FloatIt first, FloatIt last,
float qScale, int32_t qOffset)
107 std::vector<T> quantized;
110 for (
auto it = first; it != last; ++it)
114 quantized.push_back(q);
121std::vector<T>
QuantizedVector(
const std::vector<float>& array,
float qScale = 1.f, int32_t qOffset = 0)
127std::vector<T>
QuantizedVector(std::initializer_list<float> array,
float qScale = 1.f, int32_t qOffset = 0)
Copyright (c) 2021 ARM Limited and Contributors.
std::enable_if_t< std::is_unsigned< Source >::value &&std::is_unsigned< Dest >::value, Dest > numeric_cast(Source source)
void IgnoreUnused(Ts &&...)
float SelectiveDequantize(T value, float scale, int32_t offset)
std::vector< T > QuantizedVector(FloatIt first, FloatIt last, float qScale, int32_t qOffset)
T SelectiveQuantize(float value, float scale, int32_t offset)
static constexpr bool value
static T Quantize(float value, float scale, int32_t offset)
static float Dequantize(T value, float scale, int32_t offset)
static armnn::BFloat16 Quantize(float value, float scale, int32_t offset)
static float Dequantize(armnn::BFloat16 value, float scale, int32_t offset)
static float Dequantize(armnn::Half value, float scale, int32_t offset)
static armnn::Half Quantize(float value, float scale, int32_t offset)
static T Quantize(float value, float scale, int32_t offset)
static float Dequantize(T value, float scale, int32_t offset)