ONE - On-device Neural Engine
Loading...
Searching...
No Matches
exo::FuseReluPass Struct Referencefinal

Class to fuse TFLRelu or TFLRelu6 into the TensorFlow Lite ops below: More...

#include <FuseReluPass.h>

Collaboration diagram for exo::FuseReluPass:

Public Member Functions

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

Detailed Description

Class to fuse TFLRelu or TFLRelu6 into the TensorFlow Lite ops below:

ADD, AVERAGE_POOL_2D, CONCATENATION, CONV_2D, DEPTHWISE_CONV_2D, FULLY_CONNECTED, L2_NORMALIZATION, L2_POOL_2D, MAX_POOL_2D, MUL

Definition at line 31 of file FuseReluPass.h.

Member Function Documentation

◆ name()

const char * exo::FuseReluPass::name ( void  ) const
inlinefinalvirtual

Reimplemented from logo::Pass.

Definition at line 33 of file FuseReluPass.h.

33{ return "exo::FuseReluPass"; }

◆ run()

bool exo::FuseReluPass::run ( loco::Graph graph)
finalvirtual

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 92 of file FuseReluPass.cpp.

93{
94 Collector collector;
95
96 for (auto node : loco::active_nodes(loco::output_nodes(g)))
97 {
98 if (node->dialect() == locoex::TFLDialect::get())
99 {
100 auto tfl_node = loco::must_cast<locoex::TFLNode *>(node);
101 tfl_node->accept(&collector);
102 }
103 }
104
105 Performer performer;
106
107 for (auto node : collector.candidates)
108 {
109 node->accept(&performer);
110 }
111
112 return collector.candidates.size() > 0;
113}
static loco::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::Node::dialect(), locoex::TFLDialect::get(), and loco::output_nodes().

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


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