ArmNN
 24.02
QSymm8PerAxisDecoder Class Reference

#include <BaseIterator.hpp>

Inheritance diagram for QSymm8PerAxisDecoder:
[legend]
Collaboration diagram for QSymm8PerAxisDecoder:
[legend]

Public Member Functions

 QSymm8PerAxisDecoder (const int8_t *data, const armnn::TensorInfo &tensorInfo)
 
float Get () const override
 
float GetScale () const
 
std::vector< float > DecodeTensor (const TensorShape &tensorShape, const bool) override
 
- Public Member Functions inherited from PerAxisIterator< const int8_t, Decoder< float > >
 PerAxisIterator (const int8_t *data=nullptr, unsigned int axisFactor=0, unsigned int axisDimensionality=0)
 
 PerAxisIterator (const int8_t *data=nullptr, const armnn::TensorShape &tensorShape=TensorShape(), const unsigned int axis=0)
 
void Reset (void *data) override
 
PerAxisIteratoroperator++ () override
 
PerAxisIteratoroperator+= (const unsigned int increment) override
 
PerAxisIteratoroperator-= (const unsigned int decrement) override
 
PerAxisIteratorSetIndexOnMem (const unsigned int index)
 
PerAxisIteratoroperator[] (const unsigned int index) override
 
- Public Member Functions inherited from Decoder< float >
 Decoder ()
 
virtual ~Decoder ()
 
virtual float Get () const=0
 
- Public Member Functions inherited from BaseIterator
 BaseIterator ()
 
virtual ~BaseIterator ()
 

Additional Inherited Members

- Protected Attributes inherited from PerAxisIterator< const int8_t, Decoder< float > >
const int8_t * m_Iterator
 
const int8_t * m_Start
 
unsigned int m_AxisIndex
 
unsigned int m_AxisDimensionality
 
unsigned int m_AxisFactor
 
unsigned int m_Index
 

Detailed Description

Definition at line 795 of file BaseIterator.hpp.

Constructor & Destructor Documentation

◆ QSymm8PerAxisDecoder()

QSymm8PerAxisDecoder ( const int8_t *  data,
const armnn::TensorInfo tensorInfo 
)
inline

Definition at line 798 of file BaseIterator.hpp.

799  : PerAxisIterator(data, tensorInfo.GetShape(), tensorInfo.GetQuantizationDim().value()),
800  m_Scales(tensorInfo.GetQuantizationScales())
801  {}

Member Function Documentation

◆ DecodeTensor()

std::vector<float> DecodeTensor ( const TensorShape tensorShape,
const bool   
)
inlineoverridevirtual

Implements Decoder< float >.

Definition at line 814 of file BaseIterator.hpp.

815  {
816  const unsigned int size = tensorShape.GetNumElements();
817  std::vector<float> decodedTensor;
818  decodedTensor.reserve(size);
819 
820  for (uint32_t i = 0; i < size; ++i)
821  {
822  SetIndexOnMem(i);
823  decodedTensor.emplace_back(armnn::Dequantize(*m_Iterator, GetScale(), 0));
824  }
825  return decodedTensor;
826  }

References armnn::Dequantize(), TensorShape::GetNumElements(), QSymm8PerAxisDecoder::GetScale(), PerAxisIterator< const int8_t, Decoder< float > >::m_Iterator, and PerAxisIterator< const int8_t, Decoder< float > >::SetIndexOnMem().

◆ Get()

float Get ( ) const
inlineoverride

◆ GetScale()

float GetScale ( ) const
inline

Definition at line 809 of file BaseIterator.hpp.

810  {
811  return m_Scales[m_AxisIndex];
812  }

References PerAxisIterator< const int8_t, Decoder< float > >::m_AxisIndex.

Referenced by QSymm8PerAxisDecoder::DecodeTensor(), and QSymm8PerAxisDecoder::Get().


The documentation for this class was generated from the following file:
armnn::TensorInfo::GetQuantizationScales
std::vector< float > GetQuantizationScales() const
Definition: Tensor.cpp:451
armnn::PerAxisIterator< const int8_t, Decoder< float > >::m_AxisIndex
unsigned int m_AxisIndex
Definition: BaseIterator.hpp:789
armnn::TensorInfo::GetQuantizationDim
Optional< unsigned int > GetQuantizationDim() const
Definition: Tensor.cpp:494
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:52
armnn::PerAxisIterator< const int8_t, Decoder< float > >::m_Iterator
const int8_t * m_Iterator
Definition: BaseIterator.hpp:787
armnn::QSymm8PerAxisDecoder::GetScale
float GetScale() const
Definition: BaseIterator.hpp:809
armnn::PerAxisIterator< const int8_t, Decoder< float > >::SetIndexOnMem
PerAxisIterator & SetIndexOnMem(const unsigned int index)
Definition: BaseIterator.hpp:764
armnn::TensorInfo::GetShape
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
armnn::PerAxisIterator< const int8_t, Decoder< float > >::PerAxisIterator
PerAxisIterator(const int8_t *data=nullptr, unsigned int axisFactor=0, unsigned int axisDimensionality=0)
Definition: BaseIterator.hpp:711
armnn::OptionalReferenceSwitch::value
const T & value() const
Definition: Optional.hpp:146