ArmNN
 24.08
BaseIterator.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017-2024 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <armnn/TypesUtils.hpp>
12 
13 #include <ResolveType.hpp>
14 
15 namespace armnn
16 {
17 
19 {
20 public:
22 
23  virtual ~BaseIterator() {}
24 
25  virtual BaseIterator& operator++() = 0;
26 
27  virtual BaseIterator& operator+=(const unsigned int increment) = 0;
28 
29  virtual BaseIterator& operator-=(const unsigned int increment) = 0;
30 
31  virtual BaseIterator& operator[](const unsigned int index) = 0;
32 };
33 
34 template<typename IType>
35 class Decoder : public BaseIterator
36 {
37 public:
38  Decoder() {}
39 
40  virtual ~Decoder() {}
41 
42  virtual void Reset(void*) = 0;
43 
44  virtual IType Get() const = 0;
45 
46  virtual std::vector<float> DecodeTensor(const TensorShape &tensorShape, bool isDepthwise = false) = 0;
47 };
48 
49 template<typename IType>
50 class Encoder : public BaseIterator
51 {
52 public:
53  Encoder() {}
54 
55  virtual ~Encoder() {}
56 
57  virtual void Reset(void*) = 0;
58 
59  virtual void Set(IType right) = 0;
60 
61  virtual IType Get() const = 0;
62 };
63 
64 template<typename T, typename Base>
65 class TypedIterator : public Base
66 {
67 public:
68  TypedIterator(T* data = nullptr)
69  : m_Iterator(data), m_Start(data)
70  {}
71 
72  void Reset(void* data) override
73  {
74  m_Iterator = reinterpret_cast<T*>(data);
76  }
77 
79  {
80  ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(m_Iterator, "TypedIterator: m_Iterator is null!");
81  ++m_Iterator;
82  return *this;
83  }
84 
85  TypedIterator& operator+=(const unsigned int increment) override
86  {
87  ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(m_Iterator, "TypedIterator: m_Iterator is null!");
88  m_Iterator += increment;
89  return *this;
90  }
91 
92  TypedIterator& operator-=(const unsigned int increment) override
93  {
94  ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(m_Iterator, "TypedIterator: m_Iterator is null!");
95  m_Iterator -= increment;
96  return *this;
97  }
98 
99  TypedIterator& operator[](const unsigned int index) override
100  {
101  ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(m_Iterator, "TypedIterator: m_Iterator is null!");
102  m_Iterator = m_Start + index;
103  return *this;
104  }
105 
106 protected:
109 };
110 
111 class QASymm8Decoder : public TypedIterator<const uint8_t, Decoder<float>>
112 {
113 public:
114  QASymm8Decoder(const uint8_t* data, const float scale, const int32_t offset)
115  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
116 
117  QASymm8Decoder(const float scale, const int32_t offset)
118  : QASymm8Decoder(nullptr, scale, offset) {}
119 
120  float Get() const override
121  {
122  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
123  }
124  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
125  {
126  const unsigned int size = tensorShape.GetNumElements();
127  std::vector<float> decodedTensor;
128  decodedTensor.reserve(size);
129 
130  for (uint32_t i = 0; i < size; ++i)
131  {
132  this->operator[](i);
133  decodedTensor.emplace_back(armnn::Dequantize(*m_Iterator, m_Scale, m_Offset));
134  }
135 
136  return decodedTensor;
137  }
138 
139 private:
140 
141  const float m_Scale;
142  const int32_t m_Offset;
143 };
144 
145 class QASymmS8Decoder : public TypedIterator<const int8_t, Decoder<float>>
146 {
147 public:
148  QASymmS8Decoder(const int8_t* data, const float scale, const int32_t offset)
149  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
150 
151  QASymmS8Decoder(const float scale, const int32_t offset)
152  : QASymmS8Decoder(nullptr, scale, offset) {}
153 
154  float Get() const override
155  {
156  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
157  }
158  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
159  {
160  const unsigned int size = tensorShape.GetNumElements();
161  std::vector<float> decodedTensor;
162  decodedTensor.reserve(size);
163 
164  for (uint32_t i = 0; i < size; ++i)
165  {
166  this->operator[](i);
167  decodedTensor.emplace_back(armnn::Dequantize(*m_Iterator, m_Scale, m_Offset));
168  }
169 
170  return decodedTensor;
171  }
172 
173 private:
174  const float m_Scale;
175  const int32_t m_Offset;
176 
177 };
178 
179 class QSymmS8Decoder : public TypedIterator<const int8_t, Decoder<float>>
180 {
181 public:
182  QSymmS8Decoder(const int8_t* data, const float scale, const int32_t offset)
183  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
184 
185  QSymmS8Decoder(const float scale, const int32_t offset)
186  : QSymmS8Decoder(nullptr, scale, offset) {}
187 
188  float Get() const override
189  {
190  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
191  }
192  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
193  {
194  const unsigned int size = tensorShape.GetNumElements();
195  std::vector<float> decodedTensor;
196  decodedTensor.reserve(size);
197 
198  for (uint32_t i = 0; i < size; ++i)
199  {
200  this->operator[](i);
201  decodedTensor.emplace_back(armnn::Dequantize(*m_Iterator, m_Scale, m_Offset));
202  }
203 
204  return decodedTensor;
205  }
206 
207 private:
208  const float m_Scale;
209  const int32_t m_Offset;
210 
211 };
212 
213 class QSymm16Decoder : public TypedIterator<const int16_t, Decoder<float>>
214 {
215 public:
216  QSymm16Decoder(const int16_t* data, const float scale, const int32_t offset)
217  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
218 
219  QSymm16Decoder(const float scale, const int32_t offset)
220  : QSymm16Decoder(nullptr, scale, offset) {}
221 
222  float Get() const override
223  {
224  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
225  }
226  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
227  {
228  const unsigned int size = tensorShape.GetNumElements();
229  std::vector<float> decodedTensor;
230  decodedTensor.reserve(size);
231 
232  for (uint32_t i = 0; i < size; ++i)
233  {
234  this->operator[](i);
235  decodedTensor.emplace_back(armnn::Dequantize(*m_Iterator, m_Scale, m_Offset));
236  }
237 
238  return decodedTensor;
239  }
240 
241 private:
242  const float m_Scale;
243  const int32_t m_Offset;
244 
245 };
246 
247 class Float16Decoder : public TypedIterator<const Half, Decoder<float>>
248 {
249 public:
250  Float16Decoder(const Half* data)
251  : TypedIterator(data) {}
252 
254  : Float16Decoder(nullptr) {}
255 
256  float Get() const override
257  {
258  float val = 0.f;
260  return val;
261  }
262  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool ) override
263  {
264  const unsigned int size = tensorShape.GetNumElements();
265  std::vector<float> decodedTensor;
266  decodedTensor.reserve(size);
267 
268  for (uint32_t i = 0; i < size; ++i)
269  {
270  float val = 0.f;
271  this->operator[](i);
273  decodedTensor.emplace_back(val);
274  }
275 
276  return decodedTensor;
277  }
278 
279 
280 };
281 
282 class Float32Decoder : public TypedIterator<const float, Decoder<float>>
283 {
284 public:
285  Float32Decoder(const float* data)
286  : TypedIterator(data) {}
287 
289  : Float32Decoder(nullptr) {}
290 
291  float Get() const override
292  {
293  return *m_Iterator;
294  }
295  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
296  {
297  const unsigned int size = tensorShape.GetNumElements();
298  std::vector<float> decodedTensor;
299 
300  decodedTensor.reserve(size);
301  decodedTensor.assign(m_Start, m_Start + size);
302 
303  return decodedTensor;
304  }
305 };
306 
307 class ScaledInt32Decoder : public TypedIterator<const int32_t, Decoder<float>>
308 {
309 public:
310  ScaledInt32Decoder(const int32_t* data, const float scale)
311  : TypedIterator(data), m_Scale(scale) {}
312 
313  ScaledInt32Decoder(const float scale)
314  : ScaledInt32Decoder(nullptr, scale) {}
315 
316  float Get() const override
317  {
318  return static_cast<float>(*m_Iterator) * m_Scale;
319  }
320  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
321  {
322  const unsigned int size = tensorShape.GetNumElements();
323  std::vector<float> decodedTensor;
324  decodedTensor.reserve(size);
325 
326  for (uint32_t i = 0; i < size; ++i)
327  {
328  this->operator[](i);
329  decodedTensor.emplace_back(static_cast<float>(*m_Iterator) * m_Scale);
330  }
331 
332  return decodedTensor;
333  }
334 
335 private:
336  const float m_Scale;
337 
338 };
339 
340 class Int32Decoder : public TypedIterator<const int32_t, Decoder<float>>
341 {
342 public:
343  Int32Decoder(const int32_t* data)
344  : TypedIterator(data) {}
345 
347  : Int32Decoder(nullptr) {}
348 
349  float Get() const override
350  {
351  return static_cast<float>(*m_Iterator);
352  }
353  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
354  {
355  const unsigned int size = tensorShape.GetNumElements();
356  std::vector<float> decodedTensor;
357  decodedTensor.reserve(size);
358 
359  for (uint32_t i = 0; i < size; ++i)
360  {
361  this->operator[](i);
362  decodedTensor.emplace_back(static_cast<float>(*m_Iterator));
363  }
364 
365  return decodedTensor;
366  }
367 };
368 
369 class Int32ToInt32tDecoder : public TypedIterator<const int32_t, Decoder<int32_t>>
370 {
371 public:
372  Int32ToInt32tDecoder(const int32_t* data)
373  : TypedIterator(data){}
374 
376  : Int32ToInt32tDecoder(nullptr) {}
377 
378  int32_t Get() const override
379  {
380  return *m_Iterator;
381  }
382  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
383  {
384  const unsigned int size = tensorShape.GetNumElements();
385  std::vector<float> decodedTensor;
386  decodedTensor.reserve(size);
387 
388  for (uint32_t i = 0; i < size; ++i)
389  {
390  this->operator[](i);
391  decodedTensor.emplace_back(static_cast<float>(*m_Iterator));
392  }
393 
394  return decodedTensor;
395  }
396 };
397 
398 class Int64Decoder : public TypedIterator<const int64_t, Decoder<double_t>>
399 {
400 public:
401  Int64Decoder(const int64_t* data)
402  : TypedIterator(data) {}
403 
405  : Int64Decoder(nullptr) {}
406 
407  double_t Get() const override
408  {
409  return static_cast<double_t>(*m_Iterator);
410  }
411  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
412  {
413  const unsigned int size = tensorShape.GetNumElements();
414  std::vector<float> decodedTensor;
415  decodedTensor.reserve(size);
416 
417  for (uint32_t i = 0; i < size; ++i)
418  {
419  this->operator[](i);
420  decodedTensor.emplace_back(static_cast<float>(*m_Iterator));
421  }
422 
423  return decodedTensor;
424  }
425 };
426 
427 class BooleanDecoder : public TypedIterator<const uint8_t, Decoder<float>>
428 {
429 public:
430  BooleanDecoder(const uint8_t* data)
431  : TypedIterator(data) {}
432 
434  : BooleanDecoder(nullptr) {}
435 
436  float Get() const override
437  {
438  return *m_Iterator;
439  }
440  std::vector<float> DecodeTensor (const TensorShape& tensorShape, const bool) override
441  {
442  const unsigned int size = tensorShape.GetNumElements();
443  std::vector<float> decodedTensor;
444  decodedTensor.reserve(size);
445 
446  for (uint32_t i = 0; i < size; ++i)
447  {
448  this->operator[](i);
449  decodedTensor.emplace_back(*m_Iterator);
450  }
451 
452  return decodedTensor;
453  }
454 };
455 
456 class BooleanDecoderBool : public TypedIterator<const uint8_t, Decoder<bool>>
457 {
458 public:
459  BooleanDecoderBool(const uint8_t* data)
460  : TypedIterator(data) {}
461 
463  : BooleanDecoderBool(nullptr) {}
464 
465  bool Get() const override
466  {
467  return *m_Iterator;
468  }
469 
470  std::vector<float> DecodeTensor(const TensorShape& tensorShape, const bool) override
471  {
472  const unsigned int size = tensorShape.GetNumElements();
473  std::vector<float> decodedTensor;
474  decodedTensor.reserve(size);
475 
476  for (uint32_t i = 0; i < size; ++i)
477  {
478  this->operator[](i);
479  decodedTensor.emplace_back(*m_Iterator);
480  }
481 
482  return decodedTensor;
483  }
484 };
485 
486 class QASymm8Encoder : public TypedIterator<uint8_t, Encoder<float>>
487 {
488 public:
489  QASymm8Encoder(uint8_t* data, const float scale, const int32_t offset)
490  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
491 
492  QASymm8Encoder(const float scale, const int32_t offset)
493  : QASymm8Encoder(nullptr, scale, offset) {}
494 
495  void Set(float right) override
496  {
497  *m_Iterator = armnn::Quantize<uint8_t>(right, m_Scale, m_Offset);
498  }
499 
500  float Get() const override
501  {
502  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
503  }
504 
505 private:
506  const float m_Scale;
507  const int32_t m_Offset;
508 };
509 
510 class QASymmS8Encoder : public TypedIterator<int8_t, Encoder<float>>
511 {
512 public:
513  QASymmS8Encoder(int8_t* data, const float scale, const int32_t offset)
514  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
515 
516  QASymmS8Encoder(const float scale, const int32_t offset)
517  : QASymmS8Encoder(nullptr, scale, offset) {}
518 
519  void Set(float right) override
520  {
521  *m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
522  }
523 
524  float Get() const override
525  {
526  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
527  }
528 
529 private:
530  const float m_Scale;
531  const int32_t m_Offset;
532 };
533 
534 class QSymmS8Encoder : public TypedIterator<int8_t, Encoder<float>>
535 {
536 public:
537  QSymmS8Encoder(int8_t* data, const float scale, const int32_t offset)
538  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
539 
540  QSymmS8Encoder(const float scale, const int32_t offset)
541  : QSymmS8Encoder(nullptr, scale, offset) {}
542 
543  void Set(float right) override
544  {
545  *m_Iterator = armnn::Quantize<int8_t>(right, m_Scale, m_Offset);
546  }
547 
548  float Get() const override
549  {
550  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
551  }
552 
553 private:
554  const float m_Scale;
555  const int32_t m_Offset;
556 };
557 
558 class QSymm16Encoder : public TypedIterator<int16_t, Encoder<float>>
559 {
560 public:
561  QSymm16Encoder(int16_t* data, const float scale, const int32_t offset)
562  : TypedIterator(data), m_Scale(scale), m_Offset(offset) {}
563 
564  QSymm16Encoder(const float scale, const int32_t offset)
565  : QSymm16Encoder(nullptr, scale, offset) {}
566 
567  void Set(float right) override
568  {
569  *m_Iterator = armnn::Quantize<int16_t>(right, m_Scale, m_Offset);
570  }
571 
572  float Get() const override
573  {
574  return armnn::Dequantize(*m_Iterator, m_Scale, m_Offset);
575  }
576 
577 private:
578  const float m_Scale;
579  const int32_t m_Offset;
580 };
581 
582 class Float16Encoder : public TypedIterator<Half, Encoder<float>>
583 {
584 public:
586  : TypedIterator(data) {}
587 
589  : Float16Encoder(nullptr) {}
590 
591  void Set(float right) override
592  {
594  }
595 
596  float Get() const override
597  {
598  float val = 0.f;
600  return val;
601  }
602 };
603 
604 class Float32Encoder : public TypedIterator<float, Encoder<float>>
605 {
606 public:
607  Float32Encoder(float* data)
608  : TypedIterator(data) {}
609 
611  : Float32Encoder(nullptr) {}
612 
613  void Set(float right) override
614  {
615  *m_Iterator = right;
616  }
617 
618  float Get() const override
619  {
620  return *m_Iterator;
621  }
622 };
623 
624 class Int32Encoder : public TypedIterator<int32_t, Encoder<float>>
625 {
626 public:
627  Int32Encoder(int32_t* data)
628  : TypedIterator(data) {}
629 
631  : Int32Encoder(nullptr) {}
632 
633  void Set(float right) override
634  {
635  *m_Iterator = static_cast<int32_t>(right);
636  }
637 
638  float Get() const override
639  {
640  return static_cast<float>(*m_Iterator);
641  }
642 };
643 
644 class Int32ToInt32tEncoder : public TypedIterator<int32_t, Encoder<int32_t>>
645 {
646 public:
647  Int32ToInt32tEncoder(int32_t* data)
648  : TypedIterator(data){}
649 
651  : Int32ToInt32tEncoder(nullptr) {}
652 
653  void Set(int32_t right) override
654  {
655  *m_Iterator = right;
656  }
657 
658  int32_t Get() const override
659  {
660  return *m_Iterator;
661  }
662 };
663 
664 class Int64Encoder : public TypedIterator<int64_t, Encoder<double>>
665 {
666 public:
667  Int64Encoder(int64_t* data)
668  : TypedIterator(data) {}
669 
671  : Int64Encoder(nullptr) {}
672 
673  void Set(double right) override
674  {
675  *m_Iterator = static_cast<int64_t>(right);
676  }
677 
678  double_t Get() const override
679  {
680  return static_cast<double>(*m_Iterator);
681  }
682 };
683 
684 class BooleanEncoder : public TypedIterator<uint8_t, Encoder<bool>>
685 {
686 public:
687  BooleanEncoder(uint8_t* data)
688  : TypedIterator(data) {}
689 
691  : BooleanEncoder(nullptr) {}
692 
693  void Set(bool right) override
694  {
695  *m_Iterator = right;
696  }
697 
698  bool Get() const override
699  {
700  return *m_Iterator;
701  }
702 };
703 
704 /// PerAxisIterator for per-axis quantization. Iterates over a tensor as layed out in memory and keeps track
705 /// of the axis index.
706 template<typename T, typename Base>
707 class PerAxisIterator : public Base
708 {
709 public:
710  PerAxisIterator(T* data = nullptr,
711  unsigned int axisFactor = 0,
712  unsigned int axisDimensionality=0)
713  : m_Iterator(data),
714  m_Start(data),
715  m_AxisIndex(0), // iterates over the dimension of axis
716  m_AxisDimensionality(axisDimensionality), // tensorShape[quantization_dim]
717  m_AxisFactor(axisFactor),
718  m_Index(0)
719  {}
720 
721  PerAxisIterator(T* data = nullptr,
722  const armnn::TensorShape& tensorShape = TensorShape(),
723  const unsigned int axis = 0)
724  : m_Iterator(data),
725  m_Start(data),
726  m_AxisIndex(0),
727  m_Index(0)
728  {
729  m_AxisDimensionality = tensorShape[axis];
730  m_AxisFactor = armnnUtils::GetNumElementsAfter(tensorShape, axis);
731  }
732 
733  void Reset(void* data) override
734  {
735  m_Iterator = reinterpret_cast<T*>(data);
737  m_AxisIndex = 0;
738  m_Index = 0;
739  }
740 
742  {
743  ++m_Index;
744  this -> operator[](m_Index);
745  return *this;
746  }
747 
748  PerAxisIterator& operator+=(const unsigned int increment) override
749  {
750  m_Index += increment;
751  this -> operator[](m_Index);
752  return *this;
753  }
754 
755  PerAxisIterator& operator-=(const unsigned int decrement) override
756  {
757  m_Index -= decrement;
758  this -> operator[](m_Index);
759  return *this;
760  }
761 
762 
763  inline PerAxisIterator& SetIndexOnMem(const unsigned int index)
764  {
765  ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(m_Iterator, "PerAxisIterator: m_Iterator is null!");
766  m_Iterator = m_Start + index;
767  if (index < m_AxisFactor || m_AxisDimensionality < 1)
768  {
769  m_AxisIndex = 0;
770  }
771  else
772  {
774  }
775  m_Index = index;
776  return *this;
777  }
778 
779  PerAxisIterator& operator[](const unsigned int index) override
780  {
781  SetIndexOnMem(index);
782  return *this;
783  }
784 
785  protected:
788  unsigned int m_AxisIndex;
789  unsigned int m_AxisDimensionality; // tensorShape[quantization_dim]
790  unsigned int m_AxisFactor;
791  unsigned int m_Index;
792 };
793 
794 class QSymm8PerAxisDecoder : public PerAxisIterator<const int8_t, Decoder<float>>
795 {
796 public:
797  QSymm8PerAxisDecoder(const int8_t* data, const armnn::TensorInfo& tensorInfo)
798  : PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
799  m_Scales(tensorInfo.GetQuantizationScales()), m_Offset(tensorInfo.GetQuantizationOffset())
800  {}
801 
802  float Get() const override
803  {
804  return armnn::Dequantize(*m_Iterator, GetScale(), m_Offset);
805  }
806 
807  // Get scale of the current value
808  float GetScale() const
809  {
810  return m_Scales[m_AxisIndex];
811  }
812 
813  std::vector<float> DecodeTensor(const TensorShape &tensorShape, const bool) override
814  {
815  const unsigned int size = tensorShape.GetNumElements();
816  std::vector<float> decodedTensor;
817  decodedTensor.reserve(size);
818 
819  for (uint32_t i = 0; i < size; ++i)
820  {
821  SetIndexOnMem(i);
822  decodedTensor.emplace_back(armnn::Dequantize(*m_Iterator, GetScale(), m_Offset));
823  }
824  return decodedTensor;
825  }
826 
827 private:
828  std::vector<float> m_Scales;
829  const int32_t m_Offset;
830 };
831 
832 class QSymm8PerAxisEncoder : public PerAxisIterator<int8_t, Encoder<float>>
833 {
834 public:
835  QSymm8PerAxisEncoder(int8_t* data, const armnn::TensorInfo& tensorInfo)
836  : PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
837  m_Scale(tensorInfo.GetQuantizationScales()), m_Offset(tensorInfo.GetQuantizationOffset())
838  {}
839 
840  void Set(float right)
841  {
842  *m_Iterator = armnn::Quantize<int8_t>(right, m_Scale[m_AxisIndex], m_Offset);
843  }
844 
845  float Get() const
846  {
847  return armnn::Dequantize(*m_Iterator, m_Scale[m_AxisIndex], m_Offset);
848  }
849 
850  // Get scale of the current value
851  float GetScale() const
852  {
853  return m_Scale[m_AxisIndex];
854  }
855 
856 private:
857  std::vector<float> m_Scale;
858  const int32_t m_Offset;
859 };
860 
861 class ScaledInt32PerAxisDecoder : public PerAxisIterator<const int32_t, Decoder<float>>
862 {
863 public:
864  ScaledInt32PerAxisDecoder(const int32_t* data, const armnn::TensorInfo tensorInfo)
865  : PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
866  m_Scales(tensorInfo.GetQuantizationScales())
867  {}
868 
869  float Get() const override
870  {
871  return armnn::Dequantize(*m_Iterator, m_Scales[m_AxisIndex], 0);
872  }
873 
874  // Get scale of the current value
875  float GetScale() const
876  {
877  return m_Scales[m_AxisIndex];
878  }
879 
880  std::vector<float> DecodeTensor(const TensorShape &tensorShape,
881  bool isDepthwise) override
882  {
883  const uint32_t size = tensorShape.GetNumElements();
884 
885  const uint32_t stepSize = isDepthwise ?
886  tensorShape[2] * tensorShape[3] : tensorShape.GetNumElements() / tensorShape[0];
887 
888  const uint32_t stepNum = size / stepSize;
889 
890  std::vector<float> decodedTensor;
891  decodedTensor.reserve(size);
892 
893  // channelMultiplier is only used in depthwise convolutions and in other cases will have no effect
894  // stepSize is the length of a contiguous area sharing a quantization scale within a tensor
895  // stepNum is the number of those steps/blocks in the tensor
896  for (uint32_t step = 0; step < stepNum; ++step)
897  {
898  //scale = (channelMultiplier * step + mult) % scaleSize;
899  for (uint32_t i = 0; i < stepSize; ++i)
900  {
901  unsigned int index = step * stepSize + i;
902  this->operator[](index);
903  decodedTensor.emplace_back(armnn::Dequantize(*m_Iterator, m_Scales[step], 0));
904  }
905  }
906  return decodedTensor;
907  }
908 
909 private:
910  std::vector<float> m_Scales;
911 };
912 
913 class QSymm16PerAxisEncoder : public PerAxisIterator<int16_t, Encoder<float>>
914 {
915 public:
916  QSymm16PerAxisEncoder(int16_t* data, const std::vector<float>& scale,
917  unsigned int axisFactor, unsigned int axisDimensionality)
918  : PerAxisIterator(data, axisFactor, axisDimensionality), m_Scale(scale) {}
919 
920  void Set(float right)
921  {
922  *m_Iterator = armnn::Quantize<int16_t>(right, m_Scale[m_AxisIndex], 0);
923  }
924 
925  float Get() const
926  {
927  return armnn::Dequantize(*m_Iterator, m_Scale[m_AxisIndex], 0);
928  }
929 
930  // Get scale of the current value
931  float GetScale() const
932  {
933  return m_Scale[m_AxisIndex];
934  }
935 
936 private:
937  std::vector<float> m_Scale;
938 };
939 
940 } // namespace armnn
armnn::ScaledInt32PerAxisDecoder::ScaledInt32PerAxisDecoder
ScaledInt32PerAxisDecoder(const int32_t *data, const armnn::TensorInfo tensorInfo)
Definition: BaseIterator.hpp:864
armnn::QASymmS8Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:158
armnn::BaseIterator::operator-=
virtual BaseIterator & operator-=(const unsigned int increment)=0
armnn::BooleanDecoderBool::Get
bool Get() const override
Definition: BaseIterator.hpp:465
armnn::QSymm8PerAxisEncoder
Definition: BaseIterator.hpp:832
armnn::Decoder
Definition: BaseIterator.hpp:35
armnn::Float16Encoder::Float16Encoder
Float16Encoder()
Definition: BaseIterator.hpp:588
armnn::Float16Encoder
Definition: BaseIterator.hpp:582
armnn::PerAxisIterator::operator+=
PerAxisIterator & operator+=(const unsigned int increment) override
Definition: BaseIterator.hpp:748
armnn::QSymm8PerAxisDecoder
Definition: BaseIterator.hpp:794
armnn::Int32Encoder::Get
float Get() const override
Definition: BaseIterator.hpp:638
armnn::Float32Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:295
armnn::TypedIterator::m_Iterator
T * m_Iterator
Definition: BaseIterator.hpp:107
armnn::Int32Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:353
armnn::QSymm8PerAxisDecoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:813
armnn::Int64Encoder::Get
double_t Get() const override
Definition: BaseIterator.hpp:678
armnn::QASymmS8Decoder::QASymmS8Decoder
QASymmS8Decoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:151
armnn::QSymm16PerAxisEncoder
Definition: BaseIterator.hpp:913
armnn::Encoder::Set
virtual void Set(IType right)=0
armnn::Int32ToInt32tEncoder::Set
void Set(int32_t right) override
Definition: BaseIterator.hpp:653
armnn::BooleanEncoder::BooleanEncoder
BooleanEncoder()
Definition: BaseIterator.hpp:690
armnn::QASymmS8Encoder::Get
float Get() const override
Definition: BaseIterator.hpp:524
armnn::QSymmS8Encoder::QSymmS8Encoder
QSymmS8Encoder(int8_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:537
armnn::Decoder::~Decoder
virtual ~Decoder()
Definition: BaseIterator.hpp:40
armnn::BaseIterator::operator++
virtual BaseIterator & operator++()=0
armnn::QSymmS8Decoder
Definition: BaseIterator.hpp:179
armnn::TypedIterator::operator+=
TypedIterator & operator+=(const unsigned int increment) override
Definition: BaseIterator.hpp:85
armnn::Int32ToInt32tDecoder::Int32ToInt32tDecoder
Int32ToInt32tDecoder()
Definition: BaseIterator.hpp:375
armnn::ScaledInt32Decoder::ScaledInt32Decoder
ScaledInt32Decoder(const int32_t *data, const float scale)
Definition: BaseIterator.hpp:310
armnn::BooleanEncoder::Get
bool Get() const override
Definition: BaseIterator.hpp:698
armnn::Encoder::Get
virtual IType Get() const =0
TypesUtils.hpp
armnn::QSymmS8Encoder::QSymmS8Encoder
QSymmS8Encoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:540
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::ScaledInt32Decoder
Definition: BaseIterator.hpp:307
armnn::Encoder::Encoder
Encoder()
Definition: BaseIterator.hpp:53
armnn::QASymmS8Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:154
armnn::QSymm8PerAxisDecoder::QSymm8PerAxisDecoder
QSymm8PerAxisDecoder(const int8_t *data, const armnn::TensorInfo &tensorInfo)
Definition: BaseIterator.hpp:797
armnn::Decoder::Decoder
Decoder()
Definition: BaseIterator.hpp:38
armnn::QSymm8PerAxisDecoder::Get
float Get() const override
Definition: BaseIterator.hpp:802
armnn::PerAxisIterator::m_AxisIndex
unsigned int m_AxisIndex
Definition: BaseIterator.hpp:788
armnn::Int64Decoder::Int64Decoder
Int64Decoder(const int64_t *data)
Definition: BaseIterator.hpp:401
armnn::QASymmS8Decoder::QASymmS8Decoder
QASymmS8Decoder(const int8_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:148
armnn::TypedIterator::TypedIterator
TypedIterator(T *data=nullptr)
Definition: BaseIterator.hpp:68
armnn::TypedIterator::Reset
void Reset(void *data) override
Definition: BaseIterator.hpp:72
armnn::ScaledInt32Decoder::ScaledInt32Decoder
ScaledInt32Decoder(const float scale)
Definition: BaseIterator.hpp:313
armnn::QASymm8Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:124
armnn::BooleanDecoderBool::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:470
ResolveType.hpp
armnn::PerAxisIterator::operator-=
PerAxisIterator & operator-=(const unsigned int decrement) override
Definition: BaseIterator.hpp:755
armnn::Half
half_float::half Half
Definition: Half.hpp:22
armnn::QASymmS8Encoder::QASymmS8Encoder
QASymmS8Encoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:516
armnn::QSymmS8Encoder::Set
void Set(float right) override
Definition: BaseIterator.hpp:543
armnn::TypedIterator::operator-=
TypedIterator & operator-=(const unsigned int increment) override
Definition: BaseIterator.hpp:92
armnn::QSymmS8Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:192
armnn::Decoder::Reset
virtual void Reset(void *)=0
armnn::BooleanDecoderBool
Definition: BaseIterator.hpp:456
NumericCast.hpp
armnn::Float16Decoder::Float16Decoder
Float16Decoder()
Definition: BaseIterator.hpp:253
armnn::TypedIterator::operator++
TypedIterator & operator++() override
Definition: BaseIterator.hpp:78
armnn::QSymm16Decoder
Definition: BaseIterator.hpp:213
TensorUtils.hpp
armnn::Int32Decoder::Int32Decoder
Int32Decoder()
Definition: BaseIterator.hpp:346
armnn::QSymm16PerAxisEncoder::Set
void Set(float right)
Definition: BaseIterator.hpp:920
armnn::Float16Encoder::Set
void Set(float right) override
Definition: BaseIterator.hpp:591
armnn::TensorShape
Definition: Tensor.hpp:20
armnn::Encoder
Definition: BaseIterator.hpp:50
armnn::Float32Decoder
Definition: BaseIterator.hpp:282
armnn::Int32ToInt32tDecoder::Int32ToInt32tDecoder
Int32ToInt32tDecoder(const int32_t *data)
Definition: BaseIterator.hpp:372
armnn::BooleanEncoder::Set
void Set(bool right) override
Definition: BaseIterator.hpp:693
armnn::QSymm16PerAxisEncoder::GetScale
float GetScale() const
Definition: BaseIterator.hpp:931
armnn::QSymmS8Decoder::QSymmS8Decoder
QSymmS8Decoder(const int8_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:182
armnn::QSymm16Encoder::Set
void Set(float right) override
Definition: BaseIterator.hpp:567
armnn::Int64Encoder::Int64Encoder
Int64Encoder()
Definition: BaseIterator.hpp:670
armnn::BooleanDecoder
Definition: BaseIterator.hpp:427
armnn::Float16Encoder::Get
float Get() const override
Definition: BaseIterator.hpp:596
armnn::TypedIterator
Definition: BaseIterator.hpp:65
armnnUtils::FloatingPointConverter::ConvertFloat16To32
static void ConvertFloat16To32(const void *srcFloat16Buffer, size_t numElements, float *dstFloat32Buffer)
Definition: FloatingPointConverter.cpp:43
armnn::Int32ToInt32tEncoder
Definition: BaseIterator.hpp:644
armnn::QASymm8Encoder::QASymm8Encoder
QASymm8Encoder(uint8_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:489
armnn::Float16Decoder
Definition: BaseIterator.hpp:247
armnn::Int32ToInt32tDecoder
Definition: BaseIterator.hpp:369
armnn::QSymm16Decoder::QSymm16Decoder
QSymm16Decoder(const int16_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:216
armnn::Float16Decoder::Float16Decoder
Float16Decoder(const Half *data)
Definition: BaseIterator.hpp:250
armnn::BaseIterator::operator+=
virtual BaseIterator & operator+=(const unsigned int increment)=0
armnn::Dequantize
float Dequantize(QuantizedType value, float scale, int32_t offset)
Dequantize an 8-bit data type into a floating point data type.
Definition: TypesUtils.cpp:48
armnn::BooleanDecoderBool::BooleanDecoderBool
BooleanDecoderBool(const uint8_t *data)
Definition: BaseIterator.hpp:459
armnn::QSymm8PerAxisEncoder::QSymm8PerAxisEncoder
QSymm8PerAxisEncoder(int8_t *data, const armnn::TensorInfo &tensorInfo)
Definition: BaseIterator.hpp:835
armnn::PerAxisIterator::m_Iterator
T * m_Iterator
Definition: BaseIterator.hpp:786
armnn::TypedIterator::m_Start
T * m_Start
Definition: BaseIterator.hpp:108
armnn::TypedIterator::operator[]
TypedIterator & operator[](const unsigned int index) override
Definition: BaseIterator.hpp:99
armnn::Decoder::DecodeTensor
virtual std::vector< float > DecodeTensor(const TensorShape &tensorShape, bool isDepthwise=false)=0
armnn::ScaledInt32PerAxisDecoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, bool isDepthwise) override
Definition: BaseIterator.hpp:880
armnn::ScaledInt32PerAxisDecoder::GetScale
float GetScale() const
Definition: BaseIterator.hpp:875
armnn::QASymm8Decoder
Definition: BaseIterator.hpp:111
armnn::Int64Decoder
Definition: BaseIterator.hpp:398
armnn::Int32Encoder::Int32Encoder
Int32Encoder()
Definition: BaseIterator.hpp:630
armnn::BaseIterator::~BaseIterator
virtual ~BaseIterator()
Definition: BaseIterator.hpp:23
armnn::QASymm8Encoder::Set
void Set(float right) override
Definition: BaseIterator.hpp:495
armnn::PerAxisIterator::operator++
PerAxisIterator & operator++() override
Definition: BaseIterator.hpp:741
armnn::Float32Encoder::Float32Encoder
Float32Encoder(float *data)
Definition: BaseIterator.hpp:607
armnn::PerAxisIterator::PerAxisIterator
PerAxisIterator(T *data=nullptr, const armnn::TensorShape &tensorShape=TensorShape(), const unsigned int axis=0)
Definition: BaseIterator.hpp:721
armnn::Float32Encoder::Float32Encoder
Float32Encoder()
Definition: BaseIterator.hpp:610
armnn::Int32Decoder
Definition: BaseIterator.hpp:340
armnn::Encoder::~Encoder
virtual ~Encoder()
Definition: BaseIterator.hpp:55
armnn::BooleanDecoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:440
armnn::PerAxisIterator::m_Start
T * m_Start
Definition: BaseIterator.hpp:787
armnn::Int64Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:411
armnn::Int32Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:349
armnn::Int64Encoder
Definition: BaseIterator.hpp:664
armnn::Decoder::Get
virtual IType Get() const =0
armnn::Float16Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:256
armnn::Float16Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:262
armnn::Int32ToInt32tDecoder::Get
int32_t Get() const override
Definition: BaseIterator.hpp:378
armnn::QSymm16Decoder::QSymm16Decoder
QSymm16Decoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:219
armnn::Float16Encoder::Float16Encoder
Float16Encoder(Half *data)
Definition: BaseIterator.hpp:585
armnn::QSymm16Encoder::QSymm16Encoder
QSymm16Encoder(int16_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:561
armnn::Int32Encoder
Definition: BaseIterator.hpp:624
armnn::Float32Encoder::Get
float Get() const override
Definition: BaseIterator.hpp:618
armnn::QSymm16Encoder
Definition: BaseIterator.hpp:558
armnn::QSymmS8Encoder::Get
float Get() const override
Definition: BaseIterator.hpp:548
armnn::QSymm8PerAxisDecoder::GetScale
float GetScale() const
Definition: BaseIterator.hpp:808
armnn::QSymmS8Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:188
armnn::QASymm8Encoder
Definition: BaseIterator.hpp:486
armnn::QASymmS8Encoder::Set
void Set(float right) override
Definition: BaseIterator.hpp:519
armnn::QSymm16Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:226
armnn::Int32ToInt32tDecoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:382
armnn::PerAxisIterator::SetIndexOnMem
PerAxisIterator & SetIndexOnMem(const unsigned int index)
Definition: BaseIterator.hpp:763
armnn::QASymmS8Encoder
Definition: BaseIterator.hpp:510
armnn::Int64Decoder::Get
double_t Get() const override
Definition: BaseIterator.hpp:407
armnn::BooleanEncoder::BooleanEncoder
BooleanEncoder(uint8_t *data)
Definition: BaseIterator.hpp:687
armnn::QSymm8PerAxisEncoder::Get
float Get() const
Definition: BaseIterator.hpp:845
armnn::PerAxisIterator::operator[]
PerAxisIterator & operator[](const unsigned int index) override
Definition: BaseIterator.hpp:779
armnnUtils::FloatingPointConverter::ConvertFloat32To16
static void ConvertFloat32To16(const float *srcFloat32Buffer, size_t numElements, void *dstFloat16Buffer)
Converts a buffer of FP32 values to FP16, and stores in the given dstFloat16Buffer.
Definition: FloatingPointConverter.cpp:17
armnn::BaseIterator::BaseIterator
BaseIterator()
Definition: BaseIterator.hpp:21
armnn::QASymm8Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:120
armnn::Int32ToInt32tEncoder::Int32ToInt32tEncoder
Int32ToInt32tEncoder()
Definition: BaseIterator.hpp:650
armnn::PerAxisIterator::Reset
void Reset(void *data) override
Definition: BaseIterator.hpp:733
armnn::ScaledInt32PerAxisDecoder::Get
float Get() const override
Definition: BaseIterator.hpp:869
armnn::QASymmS8Encoder::QASymmS8Encoder
QASymmS8Encoder(int8_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:513
armnn::QSymm16Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:222
armnn::QSymmS8Decoder::QSymmS8Decoder
QSymmS8Decoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:185
armnn::QASymm8Encoder::Get
float Get() const override
Definition: BaseIterator.hpp:500
armnn::QSymm16PerAxisEncoder::Get
float Get() const
Definition: BaseIterator.hpp:925
armnn::ScaledInt32Decoder::DecodeTensor
std::vector< float > DecodeTensor(const TensorShape &tensorShape, const bool) override
Definition: BaseIterator.hpp:320
FloatingPointConverter.hpp
armnn::Int64Encoder::Set
void Set(double right) override
Definition: BaseIterator.hpp:673
armnnUtils::GetNumElementsAfter
unsigned int GetNumElementsAfter(const armnn::TensorShape &shape, unsigned int axis)
Definition: TensorUtils.cpp:261
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::BooleanDecoderBool::BooleanDecoderBool
BooleanDecoderBool()
Definition: BaseIterator.hpp:462
armnn::Int32ToInt32tEncoder::Get
int32_t Get() const override
Definition: BaseIterator.hpp:658
armnn::BooleanDecoder::BooleanDecoder
BooleanDecoder(const uint8_t *data)
Definition: BaseIterator.hpp:430
armnn::BooleanDecoder::BooleanDecoder
BooleanDecoder()
Definition: BaseIterator.hpp:433
armnn::PerAxisIterator::m_AxisFactor
unsigned int m_AxisFactor
Definition: BaseIterator.hpp:790
armnn::BooleanEncoder
Definition: BaseIterator.hpp:684
armnn::Int64Decoder::Int64Decoder
Int64Decoder()
Definition: BaseIterator.hpp:404
armnn::BaseIterator
Definition: BaseIterator.hpp:18
armnn::PerAxisIterator
PerAxisIterator for per-axis quantization.
Definition: BaseIterator.hpp:707
armnn::Float32Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:291
armnn::Int32ToInt32tEncoder::Int32ToInt32tEncoder
Int32ToInt32tEncoder(int32_t *data)
Definition: BaseIterator.hpp:647
armnn::PerAxisIterator::m_Index
unsigned int m_Index
Definition: BaseIterator.hpp:791
armnn::Int32Encoder::Set
void Set(float right) override
Definition: BaseIterator.hpp:633
armnn::Float32Decoder::Float32Decoder
Float32Decoder()
Definition: BaseIterator.hpp:288
armnn::BooleanDecoder::Get
float Get() const override
Definition: BaseIterator.hpp:436
armnn::QSymm16Encoder::Get
float Get() const override
Definition: BaseIterator.hpp:572
armnn::ScaledInt32Decoder::Get
float Get() const override
Definition: BaseIterator.hpp:316
armnn::Int32Encoder::Int32Encoder
Int32Encoder(int32_t *data)
Definition: BaseIterator.hpp:627
armnn::QASymm8Encoder::QASymm8Encoder
QASymm8Encoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:492
armnn::Float32Decoder::Float32Decoder
Float32Decoder(const float *data)
Definition: BaseIterator.hpp:285
armnn::Encoder::Reset
virtual void Reset(void *)=0
armnn::PerAxisIterator::PerAxisIterator
PerAxisIterator(T *data=nullptr, unsigned int axisFactor=0, unsigned int axisDimensionality=0)
Definition: BaseIterator.hpp:710
armnn::TensorShape::GetNumElements
unsigned int GetNumElements() const
Function that calculates the tensor elements by multiplying all dimension size which are Specified.
Definition: Tensor.cpp:181
armnn::Float32Encoder
Definition: BaseIterator.hpp:604
armnn::Int64Encoder::Int64Encoder
Int64Encoder(int64_t *data)
Definition: BaseIterator.hpp:667
armnn::Int32Decoder::Int32Decoder
Int32Decoder(const int32_t *data)
Definition: BaseIterator.hpp:343
armnn::QASymm8Decoder::QASymm8Decoder
QASymm8Decoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:117
armnn::QSymmS8Encoder
Definition: BaseIterator.hpp:534
armnn::QASymm8Decoder::QASymm8Decoder
QASymm8Decoder(const uint8_t *data, const float scale, const int32_t offset)
Definition: BaseIterator.hpp:114
armnn::BaseIterator::operator[]
virtual BaseIterator & operator[](const unsigned int index)=0
armnn::PerAxisIterator::m_AxisDimensionality
unsigned int m_AxisDimensionality
Definition: BaseIterator.hpp:789
armnn::ScaledInt32PerAxisDecoder
Definition: BaseIterator.hpp:861
armnn::QSymm8PerAxisEncoder::Set
void Set(float right)
Definition: BaseIterator.hpp:840
armnn::Float32Encoder::Set
void Set(float right) override
Definition: BaseIterator.hpp:613
armnn::QSymm16PerAxisEncoder::QSymm16PerAxisEncoder
QSymm16PerAxisEncoder(int16_t *data, const std::vector< float > &scale, unsigned int axisFactor, unsigned int axisDimensionality)
Definition: BaseIterator.hpp:916
armnn::QSymm8PerAxisEncoder::GetScale
float GetScale() const
Definition: BaseIterator.hpp:851
armnn::QASymmS8Decoder
Definition: BaseIterator.hpp:145
ARMNN_THROW_INVALIDARG_MSG_IF_FALSE
#define ARMNN_THROW_INVALIDARG_MSG_IF_FALSE(_cond, _str)
Definition: Exceptions.hpp:210
armnn::QSymm16Encoder::QSymm16Encoder
QSymm16Encoder(const float scale, const int32_t offset)
Definition: BaseIterator.hpp:564