ONE - On-device Neural Engine
Loading...
Searching...
No Matches
loco::CanonicalNode Struct Referenceabstract

#include <CanonicalNodeDecl.h>

Collaboration diagram for loco::CanonicalNode:

Public Member Functions

virtual ~CanonicalNode ()=default
 
const Dialectdialect (void) const final
 Return "Dialect" identifier that this node belongs to.
 
virtual CanonicalOpcode opcode (void) const =0
 
template<typename T >
accept (CanonicalNodeVisitorBase< T > *) const
 
template<typename T >
accept (CanonicalNodeMutableVisitorBase< T > *)
 
- Public Member Functions inherited from loco::Node
 Node ()=default
 
 Node (const Node &)=delete
 
 Node (Node &&)=delete
 
virtual ~Node ()
 
Graphgraph (void)
 
const Graphgraph (void) const
 
virtual uint32_t opnum (void) const =0
 
virtual uint32_t arity (void) const =0
 Return the number of arguments.
 
virtual Nodearg (uint32_t N) const =0
 Access N-th argument node.
 
virtual void drop (void)=0
 Drop all the reference of arguments.
 
- 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.
 

Detailed Description

Definition at line 28 of file CanonicalNodeDecl.h.

Constructor & Destructor Documentation

◆ ~CanonicalNode()

virtual loco::CanonicalNode::~CanonicalNode ( )
virtualdefault

Member Function Documentation

◆ accept() [1/2]

template<typename T >
T loco::CanonicalNode::accept ( CanonicalNodeMutableVisitorBase< T > *  v)

Definition at line 45 of file CanonicalNodeImpl.h.

46{
47 switch (this->opcode())
48 {
49#define CANONICAL_NODE(OPCODE, CLASS) \
50 case CanonicalOpcode::OPCODE: \
51 return v->visit(dynamic_cast<CLASS *>(this));
52
53#include "CanonicalNodes.lst"
54#undef CANONICAL_NODE
55 default:
56 break;
57 }
58
59 throw std::runtime_error{"NYI"};
60}
virtual CanonicalOpcode opcode(void) const =0

References opcode().

◆ accept() [2/2]

template<typename T >
T loco::CanonicalNode::accept ( CanonicalNodeVisitorBase< T > *  v) const

Definition at line 28 of file CanonicalNodeImpl.h.

29{
30 switch (this->opcode())
31 {
32#define CANONICAL_NODE(OPCODE, CLASS) \
33 case CanonicalOpcode::OPCODE: \
34 return v->visit(dynamic_cast<const CLASS *>(this));
35
36#include "CanonicalNodes.lst"
37#undef CANONICAL_NODE
38 default:
39 break;
40 }
41
42 throw std::runtime_error{"NYI"};
43}

References opcode().

◆ dialect()

const Dialect * loco::CanonicalNode::dialect ( void  ) const
finalvirtual

Return "Dialect" identifier that this node belongs to.

dialect() SHOULD return a valid pointer.

Implements loco::Node.

Definition at line 23 of file CanonicalNode.cpp.

23{ return CanonicalDialect::get(); }
static Dialect * get(void)

References loco::CanonicalDialect::get().

◆ opcode()

virtual CanonicalOpcode loco::CanonicalNode::opcode ( void  ) const
pure virtual

Implemented in loco::CanonicalNodeDef< Code, Mixins >, loco::CanonicalNodeDef< CanonicalOpcode::AvgPool2D, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::BiasDecode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::BiasEncode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::ConstGen, FixedArity< 0 >::Mixin, With< NodeTrait::DataType >::Mixin, With< NodeTrait::TensorShape >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::Conv2D, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::DepthwiseConv2D, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::DepthwiseFilterDecode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::DepthwiseFilterEncode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::EltwiseAdd, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::EltwiseDiv, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::EltwiseMax, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::EltwiseMul, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::EltwiseSqrt, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::EltwiseSub, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::FeatureBiasAdd, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::FeatureDecode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::FeatureEncode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::FilterDecode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::FilterEncode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::FixedReshape, FixedArity< 1 >::Mixin, With< NodeTrait::TensorShape >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::Forward, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::MatMul, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::MatrixDecode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::MatrixEncode, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::MaxPool2D, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::Pull, FixedArity< 0 >::Mixin, With< NodeTrait::TensorShape >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::Push, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::ReLU, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::ReLU6, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::Tanh, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::TensorBiasAdd, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::TensorBroadcast, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::TensorConcat, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::TensorConstantPad, FixedArity< 2 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::TensorReduce, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::TensorSoftmax, FixedArity< 1 >::Mixin >, loco::CanonicalNodeDef< CanonicalOpcode::TensorTranspose, FixedArity< 1 >::Mixin >, and loco::CanonicalNodeDef< CanonicalOpcode::TransposedConv2D, FixedArity< 2 >::Mixin >.

Referenced by accept(), and accept().


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