ONE - On-device Neural Engine
Loading...
Searching...
No Matches
loco::PermutingDecoder< Domain::Feature > Class Referencefinal

#include <PermutingCodec.h>

Collaboration diagram for loco::PermutingDecoder< Domain::Feature >:

Public Member Functions

 PermutingDecoder ()=default
 
 PermutingDecoder (const Permutation< Domain::Feature > &perm)
 
bool valid (void) const
 
TensorShape shape (const FeatureShape &tensor_shape) const override
 
FeatureIndex value (const TensorIndex &index) const override
 
std::unique_ptr< FeatureDecoderclone (void) const override
 
const Permutation< Domain::Feature > * perm (void) const
 
Permutation< Domain::Feature > * perm (void)
 
void perm (const Permutation< Domain::Feature > &p)
 
- Public Member Functions inherited from loco::FeatureDecoder
virtual ~FeatureDecoder ()=default
 

Detailed Description

Definition at line 105 of file PermutingCodec.h.

Constructor & Destructor Documentation

◆ PermutingDecoder() [1/2]

loco::PermutingDecoder< Domain::Feature >::PermutingDecoder ( )
default

◆ PermutingDecoder() [2/2]

loco::PermutingDecoder< Domain::Feature >::PermutingDecoder ( const Permutation< Domain::Feature > &  perm)
inline

Definition at line 111 of file PermutingCodec.h.

111 : _perm{perm}
112 {
113 // DO NOTHING
114 }
const Permutation< Domain::Feature > * perm(void) const

Member Function Documentation

◆ clone()

std::unique_ptr< FeatureDecoder > loco::PermutingDecoder< Domain::Feature >::clone ( void  ) const
overridevirtual

Implements loco::FeatureDecoder.

Definition at line 179 of file PermutingCodec.cpp.

180{
181 return std::make_unique<PermutingDecoder<Domain::Feature>>(_perm);
182}

◆ perm() [1/3]

void loco::PermutingDecoder< Domain::Feature >::perm ( const Permutation< Domain::Feature > &  p)
inline

Definition at line 128 of file PermutingCodec.h.

128{ _perm = p; }

◆ perm() [2/3]

Definition at line 127 of file PermutingCodec.h.

127{ return &_perm; }

◆ perm() [3/3]

const Permutation< Domain::Feature > * loco::PermutingDecoder< Domain::Feature >::perm ( void  ) const
inline

Definition at line 126 of file PermutingCodec.h.

126{ return &_perm; }

◆ shape()

TensorShape loco::PermutingDecoder< Domain::Feature >::shape ( const FeatureShape tensor_shape) const
overridevirtual

Implements loco::FeatureDecoder.

Definition at line 149 of file PermutingCodec.cpp.

150{
151 assert(valid() && "invalid permuation");
152
153 TensorShape out;
154
155 out.rank(4);
156
157 out.dim(_perm[FeatureAxis::Count]) = in.count();
158 out.dim(_perm[FeatureAxis::Depth]) = in.depth();
159 out.dim(_perm[FeatureAxis::Height]) = in.height();
160 out.dim(_perm[FeatureAxis::Width]) = in.width();
161
162 return out;
163}
uint32_t rank(void) const
Definition Shape.cpp:35
::nncc::core::ADT::tensor::Shape TensorShape
Definition TensorShape.h:25

References loco::Count, loco::FeatureShape::count(), loco::Depth, loco::FeatureShape::depth(), loco::TensorShape::dim(), loco::Height, loco::FeatureShape::height(), loco::TensorShape::rank(), loco::valid(), loco::Width, and loco::FeatureShape::width().

Referenced by RandomDataGenerator.RandomDataGenerator::_gen_float32(), RandomDataGenerator.RandomDataGenerator::_gen_int16(), and RandomDataGenerator.RandomDataGenerator::_gen_uint8().

◆ valid()

bool loco::PermutingDecoder< Domain::Feature >::valid ( void  ) const

Definition at line 184 of file PermutingCodec.cpp.

184{ return ::valid(_perm); }

◆ value()

FeatureIndex loco::PermutingDecoder< Domain::Feature >::value ( const TensorIndex index) const
overridevirtual

Implements loco::FeatureDecoder.

Definition at line 165 of file PermutingCodec.cpp.

166{
167 assert(valid() && "invalid permutation");
168
169 FeatureIndex out;
170
171 out.batch() = in.at(_perm[FeatureAxis::Count]);
172 out.channel() = in.at(_perm[FeatureAxis::Depth]);
173 out.row() = in.at(_perm[FeatureAxis::Height]);
174 out.column() = in.at(_perm[FeatureAxis::Width]);
175
176 return out;
177}

References nncc::core::ADT::tensor::Index::at(), loco::FeatureIndex::batch(), loco::FeatureIndex::channel(), loco::FeatureIndex::column(), loco::Count, loco::Depth, loco::Height, loco::FeatureIndex::row(), loco::valid(), and loco::Width.


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