34 template<
typename IType>
42 virtual void Reset(
void*) = 0;
44 virtual IType
Get()
const = 0;
49 template<
typename IType>
57 virtual void Reset(
void*) = 0;
59 virtual void Set(IType right) = 0;
61 virtual IType
Get()
const = 0;
64 template<
typename T,
typename Base>
120 float Get()
const override
127 std::vector<float> decodedTensor;
128 decodedTensor.reserve(size);
130 for (uint32_t i = 0; i < size; ++i)
136 return decodedTensor;
142 const int32_t m_Offset;
154 float Get()
const override
161 std::vector<float> decodedTensor;
162 decodedTensor.reserve(size);
164 for (uint32_t i = 0; i < size; ++i)
170 return decodedTensor;
175 const int32_t m_Offset;
188 float Get()
const override
195 std::vector<float> decodedTensor;
196 decodedTensor.reserve(size);
198 for (uint32_t i = 0; i < size; ++i)
204 return decodedTensor;
209 const int32_t m_Offset;
222 float Get()
const override
229 std::vector<float> decodedTensor;
230 decodedTensor.reserve(size);
232 for (uint32_t i = 0; i < size; ++i)
238 return decodedTensor;
243 const int32_t m_Offset;
256 float Get()
const override
265 std::vector<float> decodedTensor;
266 decodedTensor.reserve(size);
268 for (uint32_t i = 0; i < size; ++i)
273 decodedTensor.emplace_back(val);
276 return decodedTensor;
291 float Get()
const override
298 std::vector<float> decodedTensor;
300 decodedTensor.reserve(size);
303 return decodedTensor;
316 float Get()
const override
318 return static_cast<float>(*m_Iterator) * m_Scale;
323 std::vector<float> decodedTensor;
324 decodedTensor.reserve(size);
326 for (uint32_t i = 0; i < size; ++i)
329 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator) * m_Scale);
332 return decodedTensor;
349 float Get()
const override
351 return static_cast<float>(*m_Iterator);
356 std::vector<float> decodedTensor;
357 decodedTensor.reserve(size);
359 for (uint32_t i = 0; i < size; ++i)
362 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator));
365 return decodedTensor;
378 int32_t
Get()
const override
385 std::vector<float> decodedTensor;
386 decodedTensor.reserve(size);
388 for (uint32_t i = 0; i < size; ++i)
391 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator));
394 return decodedTensor;
407 double_t
Get()
const override
409 return static_cast<double_t
>(*m_Iterator);
414 std::vector<float> decodedTensor;
415 decodedTensor.reserve(size);
417 for (uint32_t i = 0; i < size; ++i)
420 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator));
423 return decodedTensor;
436 float Get()
const override
443 std::vector<float> decodedTensor;
444 decodedTensor.reserve(size);
446 for (uint32_t i = 0; i < size; ++i)
452 return decodedTensor;
473 std::vector<float> decodedTensor;
474 decodedTensor.reserve(size);
476 for (uint32_t i = 0; i < size; ++i)
482 return decodedTensor;
495 void Set(
float right)
override
497 *
m_Iterator = armnn::Quantize<uint8_t>(right, m_Scale, m_Offset);
500 float Get()
const override
507 const int32_t m_Offset;
519 void Set(
float right)
override
521 *
m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
524 float Get()
const override
531 const int32_t m_Offset;
543 void Set(
float right)
override
545 *
m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
548 float Get()
const override
555 const int32_t m_Offset;
567 void Set(
float right)
override
569 *
m_Iterator = armnn::Quantize<int16_t>(right, m_Scale, m_Offset);
572 float Get()
const override
579 const int32_t m_Offset;
591 void Set(
float right)
override
596 float Get()
const override
613 void Set(
float right)
override
618 float Get()
const override
633 void Set(
float right)
override
638 float Get()
const override
640 return static_cast<float>(*m_Iterator);
653 void Set(int32_t right)
override
658 int32_t
Get()
const override
673 void Set(
double right)
override
678 double_t
Get()
const override
680 return static_cast<double>(*m_Iterator);
693 void Set(
bool right)
override
706 template<
typename T,
typename Base>
711 unsigned int axisFactor = 0,
712 unsigned int axisDimensionality=0)
723 const unsigned int axis = 0)
798 :
PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
799 m_Scales(tensorInfo.GetQuantizationScales()), m_Offset(tensorInfo.GetQuantizationOffset())
802 float Get()
const override
816 std::vector<float> decodedTensor;
817 decodedTensor.reserve(size);
819 for (uint32_t i = 0; i < size; ++i)
824 return decodedTensor;
828 std::vector<float> m_Scales;
829 const int32_t m_Offset;
836 :
PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
837 m_Scale(tensorInfo.GetQuantizationScales()), m_Offset(tensorInfo.GetQuantizationOffset())
857 std::vector<float> m_Scale;
858 const int32_t m_Offset;
865 :
PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
866 m_Scales(tensorInfo.GetQuantizationScales())
869 float Get()
const override
881 bool isDepthwise)
override
885 const uint32_t stepSize = isDepthwise ?
886 tensorShape[2] * tensorShape[3] : tensorShape.
GetNumElements() / tensorShape[0];
888 const uint32_t stepNum = size / stepSize;
890 std::vector<float> decodedTensor;
891 decodedTensor.reserve(size);
896 for (uint32_t step = 0; step < stepNum; ++step)
899 for (uint32_t i = 0; i < stepSize; ++i)
901 unsigned int index = step * stepSize + i;
906 return decodedTensor;
910 std::vector<float> m_Scales;
917 unsigned int axisFactor,
unsigned int axisDimensionality)
918 :
PerAxisIterator(data, axisFactor, axisDimensionality), m_Scale(scale) {}
937 std::vector<float> m_Scale;