36 template<
typename IType>
44 virtual void Reset(
void*) = 0;
46 virtual IType
Get()
const = 0;
48 virtual std::vector<float>
50 bool isDepthwise =
false) = 0;
53 template<
typename IType>
61 virtual void Reset(
void*) = 0;
63 virtual void Set(IType right) = 0;
65 virtual IType
Get()
const = 0;
68 template<
typename T,
typename Base>
124 float Get()
const override
129 const bool isDepthwise)
override
134 std::vector<float> decodedTensor;
135 decodedTensor.reserve(size);
137 for (uint32_t i = 0; i < size; ++i)
143 return decodedTensor;
149 const int32_t m_Offset;
161 float Get()
const override
166 const bool isDepthwise)
override
171 std::vector<float> decodedTensor;
172 decodedTensor.reserve(size);
174 for (uint32_t i = 0; i < size; ++i)
180 return decodedTensor;
185 const int32_t m_Offset;
198 float Get()
const override
203 const bool isDepthwise)
override
208 std::vector<float> decodedTensor;
209 decodedTensor.reserve(size);
211 for (uint32_t i = 0; i < size; ++i)
217 return decodedTensor;
222 const int32_t m_Offset;
235 float Get()
const override
240 const bool isDepthwise)
override
245 std::vector<float> decodedTensor;
246 decodedTensor.reserve(size);
248 for (uint32_t i = 0; i < size; ++i)
254 return decodedTensor;
259 const int32_t m_Offset;
272 float Get()
const override
279 const bool isDepthwise)
override
284 std::vector<float> decodedTensor;
285 decodedTensor.reserve(size);
287 for (uint32_t i = 0; i < size; ++i)
292 decodedTensor.emplace_back(val);
295 return decodedTensor;
310 float Get()
const override
315 const bool isDepthwise)
override
319 std::vector<float> decodedTensor;
321 decodedTensor.reserve(size);
324 return decodedTensor;
337 float Get()
const override
339 return static_cast<float>(*m_Iterator) * m_Scale;
342 const bool isDepthwise)
override
347 std::vector<float> decodedTensor;
348 decodedTensor.reserve(size);
350 for (uint32_t i = 0; i < size; ++i)
353 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator) * m_Scale);
356 return decodedTensor;
373 float Get()
const override
375 return static_cast<float>(*m_Iterator);
378 const bool isDepthwise)
override
383 std::vector<float> decodedTensor;
384 decodedTensor.reserve(size);
386 for (uint32_t i = 0; i < size; ++i)
389 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator));
392 return decodedTensor;
405 int32_t
Get()
const override
410 const bool isDepthwise)
override
415 std::vector<float> decodedTensor;
416 decodedTensor.reserve(size);
418 for (uint32_t i = 0; i < size; ++i)
421 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator));
424 return decodedTensor;
437 float Get()
const override
442 const bool isDepthwise)
override
447 std::vector<float> decodedTensor;
448 decodedTensor.reserve(size);
450 for (uint32_t i = 0; i < size; ++i)
456 return decodedTensor;
475 const bool isDepthwise)
override
480 std::vector<float> decodedTensor;
481 decodedTensor.reserve(size);
483 for (uint32_t i = 0; i < size; ++i)
489 return decodedTensor;
502 void Set(
float right)
override
504 *
m_Iterator = armnn::Quantize<uint8_t>(right, m_Scale, m_Offset);
507 float Get()
const override
514 const int32_t m_Offset;
526 void Set(
float right)
override
528 *
m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
531 float Get()
const override
538 const int32_t m_Offset;
550 void Set(
float right)
override
552 *
m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
555 float Get()
const override
562 const int32_t m_Offset;
574 void Set(
float right)
override
576 *
m_Iterator = armnn::Quantize<int16_t>(right, m_Scale, m_Offset);
579 float Get()
const override
586 const int32_t m_Offset;
598 void Set(
float right)
override
603 float Get()
const override
620 void Set(
float right)
override
625 float Get()
const override
640 void Set(
float right)
override
645 float Get()
const override
647 return static_cast<float>(*m_Iterator);
660 void Set(int32_t right)
override
665 int32_t
Get()
const override
680 void Set(
bool right)
override
693 template<
typename T,
typename Base>
698 unsigned int axisFactor = 0,
699 unsigned int axisDimensionality=0)
710 const unsigned int axis = 0)
785 :
PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
786 m_Scales(tensorInfo.GetQuantizationScales())
789 float Get()
const override
801 bool isDepthwise)
override
806 std::vector<float> decodedTensor;
807 decodedTensor.reserve(size);
809 for (uint32_t i = 0; i < size; ++i)
814 return decodedTensor;
818 std::vector<float> m_Scales;
844 std::vector<float> m_Scale;
851 :
PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
852 m_Scales(tensorInfo.GetQuantizationScales())
855 float Get()
const override
867 bool isDepthwise)
override
871 const uint32_t stepSize = isDepthwise ?
872 tensorShape[2] * tensorShape[3] : tensorShape.
GetNumElements() / tensorShape[0];
874 const uint32_t stepNum = size / stepSize;
876 std::vector<float> decodedTensor;
877 decodedTensor.reserve(size);
882 for (uint32_t step = 0; step < stepNum; ++step)
885 for (uint32_t i = 0; i < stepSize; ++i)
887 unsigned int index = step * stepSize + i;
892 return decodedTensor;
896 std::vector<float> m_Scales;