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

Permutation-based Tensor-to-Matrix converter. More...

#include <PermutingCodec.h>

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

Public Member Functions

 PermutingEncoder ()=default
 
 PermutingEncoder (const Permutation< Domain::Matrix > &perm)
 
bool valid (void) const
 
MatrixShape shape (const TensorShape &tensor_shape) const override
 
TensorIndex value (const MatrixIndex &index) const override
 
const Permutation< Domain::Matrix > * perm (void) const
 
Permutation< Domain::Matrix > * perm (void)
 
void perm (const Permutation< Domain::Matrix > &p)
 
- Public Member Functions inherited from loco::MatrixEncoder
virtual ~MatrixEncoder ()=default
 

Detailed Description

Permutation-based Tensor-to-Matrix converter.

Definition at line 362 of file PermutingCodec.h.

Constructor & Destructor Documentation

◆ PermutingEncoder() [1/2]

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

◆ PermutingEncoder() [2/2]

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

Definition at line 368 of file PermutingCodec.h.

368 : _perm{perm}
369 {
370 // DO NOTHING
371 }
const Permutation< Domain::Matrix > * perm(void) const

Member Function Documentation

◆ perm() [1/3]

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

Definition at line 383 of file PermutingCodec.h.

383{ _perm = p; }

◆ perm() [2/3]

Definition at line 382 of file PermutingCodec.h.

382{ return &_perm; }

◆ perm() [3/3]

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

Definition at line 381 of file PermutingCodec.h.

381{ return &_perm; }

◆ shape()

MatrixShape loco::PermutingEncoder< Domain::Matrix >::shape ( const TensorShape tensor_shape) const
overridevirtual

Implements loco::MatrixEncoder.

Definition at line 570 of file PermutingCodec.cpp.

571{
572 assert(valid() && "invalid permutation");
573
574 MatrixShape out;
575
576 out.height() = in.dim(_perm[MatrixAxis::Height]);
577 out.width() = in.dim(_perm[MatrixAxis::Width]);
578
579 return out;
580}

References loco::TensorShape::dim(), loco::Height, loco::MatrixShape::height(), loco::valid(), loco::Width, and loco::MatrixShape::width().

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

◆ valid()

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

Definition at line 596 of file PermutingCodec.cpp.

596{ return ::valid(_perm); }

◆ value()

TensorIndex loco::PermutingEncoder< Domain::Matrix >::value ( const MatrixIndex index) const
overridevirtual

Implements loco::MatrixEncoder.

Definition at line 582 of file PermutingCodec.cpp.

583{
584 assert(valid() && "invalid permutation");
585
586 TensorIndex out;
587
588 out.resize(2);
589
590 out.at(_perm[MatrixAxis::Height]) = in.row();
591 out.at(_perm[MatrixAxis::Width]) = in.column();
592
593 return out;
594}
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::MatrixIndex::column(), loco::Height, nncc::core::ADT::tensor::Index::resize(), loco::MatrixIndex::row(), loco::valid(), and loco::Width.


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