ArmNN
 24.02
ScaledInt32Decoder Class Reference

#include <BaseIterator.hpp>

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

Public Member Functions

 ScaledInt32Decoder (const int32_t *data, const float scale)
 
 ScaledInt32Decoder (const float scale)
 
float Get () const override
 
std::vector< float > DecodeTensor (const TensorShape &tensorShape, const bool) override
 
- Public Member Functions inherited from TypedIterator< const int32_t, Decoder< float > >
 TypedIterator (const int32_t *data=nullptr)
 
void Reset (void *data) override
 
TypedIteratoroperator++ () override
 
TypedIteratoroperator+= (const unsigned int increment) override
 
TypedIteratoroperator-= (const unsigned int increment) override
 
TypedIteratoroperator[] (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 TypedIterator< const int32_t, Decoder< float > >
const int32_t * m_Iterator
 
const int32_t * m_Start
 

Detailed Description

Definition at line 308 of file BaseIterator.hpp.

Constructor & Destructor Documentation

◆ ScaledInt32Decoder() [1/2]

ScaledInt32Decoder ( const int32_t *  data,
const float  scale 
)
inline

Definition at line 311 of file BaseIterator.hpp.

312  : TypedIterator(data), m_Scale(scale) {}

◆ ScaledInt32Decoder() [2/2]

ScaledInt32Decoder ( const float  scale)
inline

Definition at line 314 of file BaseIterator.hpp.

315  : ScaledInt32Decoder(nullptr, scale) {}

Member Function Documentation

◆ DecodeTensor()

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

Implements Decoder< float >.

Definition at line 321 of file BaseIterator.hpp.

322  {
323  const unsigned int size = tensorShape.GetNumElements();
324  std::vector<float> decodedTensor;
325  decodedTensor.reserve(size);
326 
327  for (uint32_t i = 0; i < size; ++i)
328  {
329  this->operator[](i);
330  decodedTensor.emplace_back(static_cast<float>(*m_Iterator) * m_Scale);
331  }
332 
333  return decodedTensor;
334  }

References TensorShape::GetNumElements(), TypedIterator< const int32_t, Decoder< float > >::m_Iterator, and TypedIterator< const int32_t, Decoder< float > >::operator[]().

◆ Get()

float Get ( ) const
inlineoverride

Definition at line 317 of file BaseIterator.hpp.

318  {
319  return static_cast<float>(*m_Iterator) * m_Scale;
320  }

The documentation for this class was generated from the following file:
armnn::TypedIterator< const int32_t, Decoder< float > >::m_Iterator
const int32_t * m_Iterator
Definition: BaseIterator.hpp:108
armnn::ScaledInt32Decoder::ScaledInt32Decoder
ScaledInt32Decoder(const int32_t *data, const float scale)
Definition: BaseIterator.hpp:311
armnn::TypedIterator< const int32_t, Decoder< float > >::TypedIterator
TypedIterator(const int32_t *data=nullptr)
Definition: BaseIterator.hpp:69
armnn::TypedIterator< const int32_t, Decoder< float > >::operator[]
TypedIterator & operator[](const unsigned int index) override
Definition: BaseIterator.hpp:100