ONE - On-device Neural Engine
Loading...
Searching...
No Matches
exo::CanonicalNodeConverter< CanonicalType > Class Template Referenceabstract

Class to convert a canonical node to TFL node. More...

#include <CanonicalNodeConverter.h>

Collaboration diagram for exo::CanonicalNodeConverter< CanonicalType >:

Public Member Functions

virtual const char * name (void) const
 
bool run (loco::Graph *graph)
 Run the pass.
 
- Public Member Functions inherited from logo::Pass
virtual ~Pass ()=default
 

Protected Member Functions

virtual bool convert (CanonicalType *node)=0
 

Detailed Description

template<typename CanonicalType>
class exo::CanonicalNodeConverter< CanonicalType >

Class to convert a canonical node to TFL node.

TODO Find a better name

Definition at line 34 of file CanonicalNodeConverter.h.

Member Function Documentation

◆ convert()

◆ name()

◆ run()

template<typename CanonicalType >
bool exo::CanonicalNodeConverter< CanonicalType >::run ( loco::Graph graph)
virtual

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 47 of file CanonicalNodeConverter.h.

48{
50 bool changed = false;
51
52 for (auto node : active_nodes)
53 {
54 // TODO Generalize this to all loco dialects
55 if (node->dialect() == loco::CanonicalDialect::get())
56 {
57 auto the_node = dynamic_cast<CanonicalType *>(node);
58 if (the_node != nullptr)
59 {
60 if (convert(the_node))
61 changed = true;
62 }
63 }
64 }
65
66 return changed;
67}
virtual bool convert(CanonicalType *node)=0
static Dialect * get(void)
std::set< loco::Node * > active_nodes(const std::vector< loco::Node * > &roots)
Enumerate all the nodes required to compute "roots".
std::vector< Node * > output_nodes(Graph *)
Definition Graph.cpp:101

References loco::active_nodes(), loco::CanonicalDialect::get(), and loco::output_nodes().

Referenced by package.infer.session::inference().


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