ONE - On-device Neural Engine
Loading...
Searching...
No Matches
moco::TFPush Class Referencefinal

Make a value visible to user. More...

#include <TFPush.h>

Collaboration diagram for moco::TFPush:

Public Member Functions

 TFPush ()=default
 
loco::Nodefrom (void) const
 
void from (loco::Node *node)
 
void index (const loco::GraphOutputIndex &index)
 
loco::GraphOutputIndex index (void) const
 Get associated output index.
 
bool indexed (void) const
 Check whether index is initialized.
 
void index_reset (void)
 Reset output index.
 
- Public Member Functions inherited from moco::FixedArityNode< 1, TFNodeImpl< TFOpcode::TFPush > >
 FixedArityNode ()
 
virtual ~FixedArityNode ()=default
 
unsigned arity (void) const final
 
loco::Nodearg (uint32_t n) const final
 
void drop (void) final
 
- Public Member Functions inherited from moco::TFNodeImpl< TFOpcode::TFPush >
virtual ~TFNodeImpl ()=default
 
uint32_t opnum (void) const final
 
TFOpcode opcode (void) const final
 
- Public Member Functions inherited from moco::TFNode
virtual ~TFNode ()=default
 
const loco::Dialectdialect (void) const final
 Return "Dialect" identifier that this node belongs to.
 
template<typename T >
accept (TFNodeVisitorBase< T > *) const
 
template<typename T >
accept (TFNodeMutableVisitorBase< T > *)
 
NodeName name (void) const
 
void name (const NodeName &name)
 
- Public Member Functions inherited from loco::Node
 Node ()=default
 
 Node (const Node &)=delete
 
 Node (Node &&)=delete
 
virtual ~Node ()
 
Graphgraph (void)
 
const Graphgraph (void) const
 
- Public Member Functions inherited from loco::AnnotatedItem< NodeAnnotation >
 AnnotatedItem ()=default
 
virtual ~AnnotatedItem ()=default
 
const T * annot (void) const
 Retrieve a stored annotation of type T.
 
void annot (std::unique_ptr< T > &&p)
 Attach or remove a new annotation of type T.
 

Additional Inherited Members

- Protected Member Functions inherited from moco::FixedArityNode< 1, TFNodeImpl< TFOpcode::TFPush > >
loco::Useat (unsigned n) const
 

Detailed Description

Make a value visible to user.

Note
TFPush is a virtual node that does not corresponds to real TensorFlow node Why this node is introduced:
  • Any TensorFlow Nodes can be an output.
  • So let any TFNode type can provide OutputIndex using Annotation.
  • Problem comes when in transformation, output node can be replaced.
  • This causes that OutputIndex Annotation should be copied to new node.
  • This makes every transformation in any Dialect code change.
  • And even worse, this makes every new transformation follow this rule.
  • Which is not good.
  • Thus, like loco Canonical does, follow loco::Push.

Definition at line 41 of file TFPush.h.

Constructor & Destructor Documentation

◆ TFPush()

moco::TFPush::TFPush ( )
default

Member Function Documentation

◆ from() [1/2]

void moco::TFPush::from ( loco::Node node)
inline

Definition at line 48 of file TFPush.h.

48{ at(0)->node(node); }
Node * node(void) const
Definition Use.h:58

References moco::FixedArityNode< 1, TFNodeImpl< TFOpcode::TFPush > >::at(), and loco::Use::node().

◆ from() [2/2]

loco::Node * moco::TFPush::from ( void  ) const
inline

Definition at line 47 of file TFPush.h.

47{ return at(0)->node(); }

References moco::FixedArityNode< 1, TFNodeImpl< TFOpcode::TFPush > >::at(), and loco::Use::node().

◆ index() [1/2]

void moco::TFPush::index ( const loco::GraphOutputIndex index)

TFPush

Definition at line 108 of file TFNode.cpp.

109{
110 // Push internally stores "GraphOutputIndex" as int64_t
111 _index = static_cast<int64_t>(index);
112}
loco::GraphOutputIndex index(void) const
Get associated output index.
Definition TFNode.cpp:114

References index().

◆ index() [2/2]

loco::GraphOutputIndex moco::TFPush::index ( void  ) const

Get associated output index.

The behavior of this method is undefined when "index" is not set before.

NOTE This method intentionally returns "GraphOutputIndex" instead of "const GraphOutputIndex &" not to expose the internal implementation details.

Definition at line 114 of file TFNode.cpp.

115{
116 assert(_index >= std::numeric_limits<loco::GraphOutputIndex>::min());
117 assert(_index <= std::numeric_limits<loco::GraphOutputIndex>::max());
118 return static_cast<loco::GraphOutputIndex>(_index);
119}
uint32_t GraphOutputIndex

Referenced by index().

◆ index_reset()

void moco::TFPush::index_reset ( void  )
inline

Reset output index.

Definition at line 73 of file TFPush.h.

73{ _index = -1; }

◆ indexed()

bool moco::TFPush::indexed ( void  ) const
inline

Check whether index is initialized.

NOTE "indexed" method does not validate whether index is in a valid range

Definition at line 68 of file TFPush.h.

68{ return _index != -1; }

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