ONE - On-device Neural Engine
Loading...
Searching...
No Matches
luci::FuseActivationFunctionPass Struct Referencefinal

Class to fuse activation functions into preceding operators. More...

#include <FuseActivationFunctionPass.h>

Collaboration diagram for luci::FuseActivationFunctionPass:

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 activation functions into preceding operators.

Definition at line 28 of file FuseActivationFunctionPass.h.

Member Function Documentation

◆ name()

const char * luci::FuseActivationFunctionPass::name ( void  ) const
inlinefinalvirtual

Reimplemented from logo::Pass.

Definition at line 30 of file FuseActivationFunctionPass.h.

30{ return "luci::FuseActivationFunctionPass"; }

◆ run()

bool luci::FuseActivationFunctionPass::run ( loco::Graph graph)
finalvirtual

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 92 of file FuseActivationFunctionPass.cpp.

93{
94 bool changed = false;
95 for (auto node : loco::active_nodes(loco::output_nodes(g)))
96 {
97 auto circle_node = static_cast<luci::CircleNode *>(node);
98 auto opcode = circle_node->opcode();
99 // TANH is not supported as CONV fused with TANH is not supported in luci-interpreter
100 if (opcode == luci::CircleOpcode::RELU || opcode == luci::CircleOpcode::RELU6 ||
101 opcode == luci::CircleOpcode::RELU_N1_TO_1)
102 {
103 if (fuse_activation_function(circle_node))
104 changed = true;
105 }
106 }
107
108 return changed;
109}
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
bool fuse_activation_function(luci::CircleNode *node)
virtual CircleOpcode opcode(void) const =0

References loco::active_nodes(), luci::fuse_activation_function(), luci::CircleNode::opcode(), and loco::output_nodes().

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


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