ArmNN
 24.08
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 794 of file BaseIterator.hpp.

Constructor & Destructor Documentation

◆ QSymm8PerAxisDecoder()

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

Definition at line 797 of file BaseIterator.hpp.

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

Member Function Documentation

◆ DecodeTensor()

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

Implements Decoder< float >.

Definition at line 813 of file BaseIterator.hpp.

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  }

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 808 of file BaseIterator.hpp.

809  {
810  return m_Scales[m_AxisIndex];
811  }

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:788
armnn::TensorInfo::GetQuantizationDim
Optional< unsigned int > GetQuantizationDim() const
Definition: Tensor.cpp:498
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::PerAxisIterator< const int8_t, Decoder< float > >::m_Iterator
const int8_t * m_Iterator
Definition: BaseIterator.hpp:786
armnn::QSymm8PerAxisDecoder::GetScale
float GetScale() const
Definition: BaseIterator.hpp:808
armnn::PerAxisIterator< const int8_t, Decoder< float > >::SetIndexOnMem
PerAxisIterator & SetIndexOnMem(const unsigned int index)
Definition: BaseIterator.hpp:763
armnn::TensorInfo::GetShape
const TensorShape & GetShape() const
Definition: Tensor.hpp:193
armnn::TensorInfo::GetQuantizationOffset
int32_t GetQuantizationOffset() const
Definition: Tensor.cpp:482
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:710
armnn::OptionalReferenceSwitch::value
const T & value() const
Definition: Optional.hpp:146