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

#include <PermutingCodec.h>

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

Public Member Functions

 PermutingEncoder ()=default
 
 PermutingEncoder (const Permutation< Domain::Feature > &perm)
 
bool valid (void) const
 
FeatureShape shape (const TensorShape &tensor_shape) const override
 
TensorIndex value (const FeatureIndex &index) const override
 
std::unique_ptr< FeatureEncoderclone (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::FeatureEncoder
virtual ~FeatureEncoder ()=default
 

Detailed Description

Definition at line 76 of file PermutingCodec.h.

Constructor & Destructor Documentation

◆ PermutingEncoder() [1/2]

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

◆ PermutingEncoder() [2/2]

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

Definition at line 82 of file PermutingCodec.h.

82 : _perm{perm}
83 {
84 // DO NOTHING
85 }
const Permutation< Domain::Feature > * perm(void) const

Member Function Documentation

◆ clone()

std::unique_ptr< FeatureEncoder > loco::PermutingEncoder< Domain::Feature >::clone ( void  ) const
overridevirtual

Implements loco::FeatureEncoder.

Definition at line 139 of file PermutingCodec.cpp.

140{
141 return std::make_unique<PermutingEncoder<Domain::Feature>>(_perm);
142}

◆ perm() [1/3]

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

Definition at line 99 of file PermutingCodec.h.

99{ _perm = p; }

◆ perm() [2/3]

Definition at line 98 of file PermutingCodec.h.

98{ return &_perm; }

◆ perm() [3/3]

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

Definition at line 97 of file PermutingCodec.h.

97{ return &_perm; }

◆ shape()

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

◆ valid()

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

Definition at line 144 of file PermutingCodec.cpp.

144{ return ::valid(_perm); }

◆ value()

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

Implements loco::FeatureEncoder.

Definition at line 123 of file PermutingCodec.cpp.

124{
125 assert(valid() && "invalid permutation");
126
127 TensorIndex out;
128
129 out.resize(4);
130
131 out.at(_perm[FeatureAxis::Count]) = in.batch();
132 out.at(_perm[FeatureAxis::Depth]) = in.channel();
133 out.at(_perm[FeatureAxis::Height]) = in.row();
134 out.at(_perm[FeatureAxis::Width]) = in.column();
135
136 return out;
137}
Index & resize(uint32_t size)
Definition Index.cpp:37
uint32_t & at(uint32_t axis)
Definition Index.cpp:49
nncc::core::ADT::tensor::Index TensorIndex
Definition TensorIndex.h:26

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


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