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

Mapping between Feature/Tensor Axis. More...

#include <PermutingCodec.h>

Public Member Functions

 Permutation ()=default
 
bool mapped (const FeatureAxis &axis_f) const
 Return whether a tensor axis is specified for a given feature axis.
 
TensorAxis axis (const FeatureAxis &axis_f) const
 Get the tensor axis corresponding to a given feature axis.
 
TensorAxisaxis (const FeatureAxis &axis_f)
 Set the tensor axis corresponding to a given feature axis.
 
TensorAxis operator[] (const FeatureAxis &axis_f) const
 
TensorAxisoperator[] (const FeatureAxis &axis_f)
 

Detailed Description

Mapping between Feature/Tensor Axis.

Definition at line 44 of file PermutingCodec.h.

Constructor & Destructor Documentation

◆ Permutation()

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

Member Function Documentation

◆ axis() [1/2]

uint32_t & loco::Permutation< Domain::Feature >::axis ( const FeatureAxis axis_f)

Set the tensor axis corresponding to a given feature axis.

Definition at line 100 of file PermutingCodec.cpp.

101{
102 assert(valid(axis_f) && "invalid feature axis");
103 return _map[axis_f];
104}
bool valid(Graph *g, std::unique_ptr< ErrorListener > &&l=nullptr)
Validate a loco graph.
Definition Verifier.cpp:100

References loco::valid().

◆ axis() [2/2]

uint32_t loco::Permutation< Domain::Feature >::axis ( const FeatureAxis axis_f) const

Get the tensor axis corresponding to a given feature axis.

This method works correclty only when feature axis is mapped before.

Definition at line 93 of file PermutingCodec.cpp.

94{
95 assert(valid(axis_f) && "invalid feature axis");
96 assert(mapped(axis_f) && "unmapped feature axis");
97 return _map.at(axis_f);
98}
bool mapped(const FeatureAxis &axis_f) const
Return whether a tensor axis is specified for a given feature axis.

References loco::valid().

◆ mapped()

bool loco::Permutation< Domain::Feature >::mapped ( const FeatureAxis axis_f) const

Return whether a tensor axis is specified for a given feature axis.

This method does not validate the corresponding value.

Definition at line 87 of file PermutingCodec.cpp.

88{
89 assert(valid(axis_f) && "invalid feature axis");
90 return _map.find(axis_f) != _map.end();
91}

References loco::valid().

◆ operator[]() [1/2]

TensorAxis & loco::Permutation< Domain::Feature >::operator[] ( const FeatureAxis axis_f)
inline

Definition at line 70 of file PermutingCodec.h.

70{ return axis(axis_f); }
TensorAxis axis(const FeatureAxis &axis_f) const
Get the tensor axis corresponding to a given feature axis.

◆ operator[]() [2/2]

TensorAxis loco::Permutation< Domain::Feature >::operator[] ( const FeatureAxis axis_f) const
inline

Definition at line 69 of file PermutingCodec.h.

69{ return axis(axis_f); }

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