35 template<
typename IType>
43 virtual void Reset(
void*) = 0;
45 virtual IType
Get()
const = 0;
50 template<
typename IType>
58 virtual void Reset(
void*) = 0;
60 virtual void Set(IType right) = 0;
62 virtual IType
Get()
const = 0;
65 template<
typename T,
typename Base>
121 float Get()
const override
128 std::vector<float> decodedTensor;
129 decodedTensor.reserve(size);
131 for (uint32_t i = 0; i < size; ++i)
137 return decodedTensor;
143 const int32_t m_Offset;
155 float Get()
const override
162 std::vector<float> decodedTensor;
163 decodedTensor.reserve(size);
165 for (uint32_t i = 0; i < size; ++i)
171 return decodedTensor;
176 const int32_t m_Offset;
189 float Get()
const override
196 std::vector<float> decodedTensor;
197 decodedTensor.reserve(size);
199 for (uint32_t i = 0; i < size; ++i)
205 return decodedTensor;
210 const int32_t m_Offset;
223 float Get()
const override
230 std::vector<float> decodedTensor;
231 decodedTensor.reserve(size);
233 for (uint32_t i = 0; i < size; ++i)
239 return decodedTensor;
244 const int32_t m_Offset;
257 float Get()
const override
266 std::vector<float> decodedTensor;
267 decodedTensor.reserve(size);
269 for (uint32_t i = 0; i < size; ++i)
274 decodedTensor.emplace_back(val);
277 return decodedTensor;
292 float Get()
const override
299 std::vector<float> decodedTensor;
301 decodedTensor.reserve(size);
304 return decodedTensor;
317 float Get()
const override
319 return static_cast<float>(*m_Iterator) * m_Scale;
324 std::vector<float> decodedTensor;
325 decodedTensor.reserve(size);
327 for (uint32_t i = 0; i < size; ++i)
330 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator) * m_Scale);
333 return decodedTensor;
350 float Get()
const override
352 return static_cast<float>(*m_Iterator);
357 std::vector<float> decodedTensor;
358 decodedTensor.reserve(size);
360 for (uint32_t i = 0; i < size; ++i)
363 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator));
366 return decodedTensor;
379 int32_t
Get()
const override
386 std::vector<float> decodedTensor;
387 decodedTensor.reserve(size);
389 for (uint32_t i = 0; i < size; ++i)
392 decodedTensor.emplace_back(
static_cast<float>(*
m_Iterator));
395 return decodedTensor;
408 double_t
Get()
const override
410 return static_cast<double_t
>(*m_Iterator);
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
444 std::vector<float> decodedTensor;
445 decodedTensor.reserve(size);
447 for (uint32_t i = 0; i < size; ++i)
453 return decodedTensor;
474 std::vector<float> decodedTensor;
475 decodedTensor.reserve(size);
477 for (uint32_t i = 0; i < size; ++i)
483 return decodedTensor;
496 void Set(
float right)
override
498 *
m_Iterator = armnn::Quantize<uint8_t>(right, m_Scale, m_Offset);
501 float Get()
const override
508 const int32_t m_Offset;
520 void Set(
float right)
override
522 *
m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
525 float Get()
const override
532 const int32_t m_Offset;
544 void Set(
float right)
override
546 *
m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
549 float Get()
const override
556 const int32_t m_Offset;
568 void Set(
float right)
override
570 *
m_Iterator = armnn::Quantize<int16_t>(right, m_Scale, m_Offset);
573 float Get()
const override
580 const int32_t m_Offset;
592 void Set(
float right)
override
597 float Get()
const override
614 void Set(
float right)
override
619 float Get()
const override
634 void Set(
float right)
override
639 float Get()
const override
641 return static_cast<float>(*m_Iterator);
654 void Set(int32_t right)
override
659 int32_t
Get()
const override
674 void Set(
double right)
override
679 double_t
Get()
const override
681 return static_cast<double>(*m_Iterator);
694 void Set(
bool right)
override
707 template<
typename T,
typename Base>
712 unsigned int axisFactor = 0,
713 unsigned int axisDimensionality=0)
724 const unsigned int axis = 0)
799 :
PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
800 m_Scales(tensorInfo.GetQuantizationScales())
803 float Get()
const override
817 std::vector<float> decodedTensor;
818 decodedTensor.reserve(size);
820 for (uint32_t i = 0; i < size; ++i)
825 return decodedTensor;
829 std::vector<float> m_Scales;
855 std::vector<float> m_Scale;
862 :
PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
863 m_Scales(tensorInfo.GetQuantizationScales())
866 float Get()
const override
878 bool isDepthwise)
override
882 const uint32_t stepSize = isDepthwise ?
883 tensorShape[2] * tensorShape[3] : tensorShape.
GetNumElements() / tensorShape[0];
885 const uint32_t stepNum = size / stepSize;
887 std::vector<float> decodedTensor;
888 decodedTensor.reserve(size);
893 for (uint32_t step = 0; step < stepNum; ++step)
896 for (uint32_t i = 0; i < stepSize; ++i)
898 unsigned int index = step * stepSize + i;
903 return decodedTensor;
907 std::vector<float> m_Scales;
914 unsigned int axisFactor,
unsigned int axisDimensionality)
915 :
PerAxisIterator(data, axisFactor, axisDimensionality), m_Scale(scale) {}
934 std::vector<float> m_Scale;