ArmNN
 23.08
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 isDepthwise) 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 328 of file BaseIterator.hpp.

Constructor & Destructor Documentation

◆ ScaledInt32Decoder() [1/2]

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

Definition at line 331 of file BaseIterator.hpp.

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

◆ ScaledInt32Decoder() [2/2]

ScaledInt32Decoder ( const float  scale)
inline

Definition at line 334 of file BaseIterator.hpp.

335  : ScaledInt32Decoder(nullptr, scale) {}

Member Function Documentation

◆ DecodeTensor()

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

Implements Decoder< float >.

Definition at line 341 of file BaseIterator.hpp.

343  {
344  IgnoreUnused(isDepthwise);
345 
346  const unsigned int size = tensorShape.GetNumElements();
347  std::vector<float> decodedTensor;
348  decodedTensor.reserve(size);
349 
350  for (uint32_t i = 0; i < size; ++i)
351  {
352  this->operator[](i);
353  decodedTensor.emplace_back(static_cast<float>(*m_Iterator) * m_Scale);
354  }
355 
356  return decodedTensor;
357  }

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

◆ Get()

float Get ( ) const
inlineoverride

Definition at line 337 of file BaseIterator.hpp.

338  {
339  return static_cast<float>(*m_Iterator) * m_Scale;
340  }

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:111
armnn::ScaledInt32Decoder::ScaledInt32Decoder
ScaledInt32Decoder(const int32_t *data, const float scale)
Definition: BaseIterator.hpp:331
armnn::TypedIterator< const int32_t, Decoder< float > >::TypedIterator
TypedIterator(const int32_t *data=nullptr)
Definition: BaseIterator.hpp:72
armnn::TypedIterator< const int32_t, Decoder< float > >::operator[]
TypedIterator & operator[](const unsigned int index) override
Definition: BaseIterator.hpp:103
armnn::IgnoreUnused
void IgnoreUnused(Ts &&...)
Definition: IgnoreUnused.hpp:14