ONE - On-device Neural Engine
Loading...
Searching...
No Matches
onert::ir::train::TrainingIndex< T > Class Template Reference

Class that provides index of tensor for training. More...

#include <Index.h>

Public Member Functions

 TrainingIndex ()
 Construct TrainingOperationIndex object.
 
 TrainingIndex (const T &index, bool is_forward)
 Construct TrainingOperationIndex object.
 
const T & index () const
 Get index.
 
bool is_forward () const
 Get whether the tensor is forward tensor or not.
 
bool valid () const
 Check if the index is valid or not.
 
bool operator== (const TrainingIndex &other) const
 operator overloading function for ==
 
bool operator!= (const TrainingIndex &other) const
 operator overloading function for !=
 
bool operator< (const TrainingIndex &other) const
 operator overloading function for <
 

Detailed Description

template<typename T>
class onert::ir::train::TrainingIndex< T >

Class that provides index of tensor for training.

Template Parameters
TType of index

Definition at line 37 of file Index.h.

Constructor & Destructor Documentation

◆ TrainingIndex() [1/2]

template<typename T >
onert::ir::train::TrainingIndex< T >::TrainingIndex ( )
inline

Construct TrainingOperationIndex object.

Parameters
indexThe operation index
is_forwardWhether the tensor is forward tensor or not

Definition at line 45 of file Index.h.

45 : _index{T{}}, _is_forward{true}
46 {
47 // DO NOTHING
48 }

◆ TrainingIndex() [2/2]

template<typename T >
onert::ir::train::TrainingIndex< T >::TrainingIndex ( const T &  index,
bool  is_forward 
)
inline

Construct TrainingOperationIndex object.

Template Parameters
TType of index
Parameters
indexThe operation index
is_forwardWhether the tensor is forward tensor or not

Definition at line 56 of file Index.h.

56 : _index{index}, _is_forward{is_forward}
57 {
58 // DO NOTHING
59 }
bool is_forward() const
Get whether the tensor is forward tensor or not.
Definition Index.h:73
const T & index() const
Get index.
Definition Index.h:67

Member Function Documentation

◆ index()

template<typename T >
const T & onert::ir::train::TrainingIndex< T >::index ( ) const
inline

Get index.

Returns
index

Definition at line 67 of file Index.h.

67{ return _index; }

Referenced by onert::ir::train::operator<<(), onert::ir::train::operator<<(), and onert::ir::train::TrainingIndex< T >::operator==().

◆ is_forward()

template<typename T >
bool onert::ir::train::TrainingIndex< T >::is_forward ( ) const
inline

Get whether the tensor is forward tensor or not.

Returns
true if the tensor is forward tensor

Definition at line 73 of file Index.h.

73{ return _is_forward; }

Referenced by onert::ir::train::TrainingIndex< T >::operator==().

◆ operator!=()

template<typename T >
bool onert::ir::train::TrainingIndex< T >::operator!= ( const TrainingIndex< T > &  other) const
inline

operator overloading function for !=

Returns
Whether two TrainingIndex are differenct

Definition at line 99 of file Index.h.

99{ return !(*this == other); }

◆ operator<()

template<typename T >
bool onert::ir::train::TrainingIndex< T >::operator< ( const TrainingIndex< T > &  other) const
inline

operator overloading function for <

Returns
Whether this TrainingIndex is less than other TrainingIndex

Definition at line 106 of file Index.h.

107 {
108 return std::hash<TrainingIndex<T>>{}(*this) < std::hash<TrainingIndex<T>>{}(other);
109 }

◆ operator==()

template<typename T >
bool onert::ir::train::TrainingIndex< T >::operator== ( const TrainingIndex< T > &  other) const
inline

operator overloading function for ==

Returns
Whether two TrainingIndex are equal

Definition at line 89 of file Index.h.

90 {
91 return (!_index.valid() && !other.index().valid()) ||
92 (_index == other.index() && _is_forward == other.is_forward());
93 }

References onert::ir::train::TrainingIndex< T >::index(), and onert::ir::train::TrainingIndex< T >::is_forward().

◆ valid()

template<typename T >
bool onert::ir::train::TrainingIndex< T >::valid ( ) const
inline

Check if the index is valid or not.

Returns
true if the index is valid, false otherwise

Definition at line 81 of file Index.h.

81{ return _index.valid(); }

Referenced by onert::ir::train::UseDefChain::insertTrainingDef().


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