ArmNN
 21.02
ScaledInt32Decoder Class Reference

#include <BaseIterator.hpp>

Inheritance diagram for ScaledInt32Decoder:
TypedIterator< const int32_t, Decoder< float > > Decoder< float > BaseIterator

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 unsigned int channelMultiplier, 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
 
TypedIteratorSetIndex (unsigned int index, unsigned int axisIndex=0) override
 
- Public Member Functions inherited from Decoder< float >
 Decoder ()
 
virtual ~Decoder ()
 
- 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 382 of file BaseIterator.hpp.

Constructor & Destructor Documentation

◆ ScaledInt32Decoder() [1/2]

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

Definition at line 385 of file BaseIterator.hpp.

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

◆ ScaledInt32Decoder() [2/2]

ScaledInt32Decoder ( const float  scale)
inline

Definition at line 388 of file BaseIterator.hpp.

389  : ScaledInt32Decoder(nullptr, scale) {}
ScaledInt32Decoder(const int32_t *data, const float scale)

Member Function Documentation

◆ DecodeTensor()

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

Implements Decoder< float >.

Definition at line 395 of file BaseIterator.hpp.

References TensorShape::GetNumElements(), armnn::IgnoreUnused(), and BaseIterator::operator[]().

398  {
399  IgnoreUnused(channelMultiplier, isDepthwise);
400 
401  const unsigned int size = tensorShape.GetNumElements();
402  std::vector<float> decodedTensor;
403  decodedTensor.reserve(size);
404 
405  for (uint32_t i = 0; i < size; ++i)
406  {
407  this->operator[](i);
408  decodedTensor.emplace_back(static_cast<float>(*m_Iterator) * m_Scale);
409  }
410 
411  return decodedTensor;
412  }
void IgnoreUnused(Ts &&...)
TypedIterator & operator[](const unsigned int index) override

◆ Get()

float Get ( ) const
inlineoverridevirtual

Implements Decoder< float >.

Definition at line 391 of file BaseIterator.hpp.

392  {
393  return static_cast<float>(*m_Iterator) * m_Scale;
394  }

The documentation for this class was generated from the following file: