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

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

#include <PermutingCodec.h>

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

Public Member Functions

 PermutingDecoder ()=default
 
 PermutingDecoder (const Permutation< Domain::Matrix > &perm)
 
bool valid (void) const
 
TensorShape shape (const MatrixShape &tensor_shape) const override
 
MatrixIndex value (const TensorIndex &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::MatrixDecoder
virtual ~MatrixDecoder ()=default
 

Detailed Description

Permutation-based Matrix-to-Tensor converter.

Definition at line 392 of file PermutingCodec.h.

Constructor & Destructor Documentation

◆ PermutingDecoder() [1/2]

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

◆ PermutingDecoder() [2/2]

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

Definition at line 398 of file PermutingCodec.h.

398 : _perm{perm}
399 {
400 // DO NOTHING
401 }
const Permutation< Domain::Matrix > * perm(void) const

Member Function Documentation

◆ perm() [1/3]

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

Definition at line 413 of file PermutingCodec.h.

413{ _perm = p; }

◆ perm() [2/3]

Definition at line 412 of file PermutingCodec.h.

412{ return &_perm; }

◆ perm() [3/3]

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

Definition at line 411 of file PermutingCodec.h.

411{ return &_perm; }

◆ shape()

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

Implements loco::MatrixDecoder.

Definition at line 601 of file PermutingCodec.cpp.

602{
603 assert(valid() && "invalid permuation");
604
605 TensorShape out;
606
607 out.rank(2);
608
609 out.dim(_perm[MatrixAxis::Height]) = in.height();
610 out.dim(_perm[MatrixAxis::Width]) = in.width();
611
612 return out;
613}
uint32_t rank(void) const
Definition Shape.cpp:35
::nncc::core::ADT::tensor::Shape TensorShape
Definition TensorShape.h:25

References loco::TensorShape::dim(), loco::Height, loco::MatrixShape::height(), loco::TensorShape::rank(), 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::PermutingDecoder< Domain::Matrix >::valid ( void  ) const

Definition at line 627 of file PermutingCodec.cpp.

627{ return ::valid(_perm); }

◆ value()

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

Implements loco::MatrixDecoder.

Definition at line 615 of file PermutingCodec.cpp.

616{
617 assert(valid() && "invalid permutation");
618
619 MatrixIndex out;
620
621 out.row() = in.at(_perm[MatrixAxis::Height]);
622 out.column() = in.at(_perm[MatrixAxis::Width]);
623
624 return out;
625}

References nncc::core::ADT::tensor::Index::at(), loco::MatrixIndex::column(), loco::Height, loco::MatrixIndex::row(), loco::valid(), and loco::Width.


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