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

Class to temove unnecessary(input and output are same) Add node. More...

#include <RemoveUnnecessaryAddPass.h>

Collaboration diagram for luci::RemoveUnnecessaryAddPass:

Public Member Functions

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

Detailed Description

Class to temove unnecessary(input and output are same) Add node.

Definition at line 28 of file RemoveUnnecessaryAddPass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 30 of file RemoveUnnecessaryAddPass.h.

30{ return "luci::RemoveUnnecessaryAddPass"; }

◆ run()

bool luci::RemoveUnnecessaryAddPass::run ( loco::Graph g)
finalvirtual

BEFORE

 [CircleNode]
       |
       |      [CircleConst(=0)]
       |     /
       |    /
  [CircleAdd] (no activation)
       |
 [CircleNode]

AFTER

 [CircleNode]
       |
       |
 [CircleNode]

Implements logo::Pass.

Definition at line 93 of file RemoveUnnecessaryAddPass.cpp.

94{
95 bool changed = false;
96 for (auto node : loco::active_nodes(loco::output_nodes(g)))
97 {
98 auto circle_node = loco::must_cast<luci::CircleNode *>(node);
99 if (remove_no_effect_add(circle_node))
100 {
101 changed = true;
102 }
103 }
104 return changed;
105}
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(), and loco::output_nodes().

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


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