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

Class to canoncalize CircleNodes. More...

#include <CanonicalizePass.h>

Collaboration diagram for luci::CanonicalizePass:

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 canoncalize CircleNodes.

Definition at line 29 of file CanonicalizePass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 31 of file CanonicalizePass.h.

31{ return "luci::CanonicalizePass"; }

◆ run()

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

Canonicalize circle nodes

Implements logo::Pass.

Definition at line 84 of file CanonicalizePass.cpp.

85{
86 bool changed = false;
87 for (auto node : loco::active_nodes(loco::output_nodes(g)))
88 {
89 if (auto pad = dynamic_cast<luci::CirclePad *>(node))
90 {
91 if (paddings_to_s32(pad))
92 changed = true;
93 }
94 else if (auto padv2 = dynamic_cast<luci::CirclePadV2 *>(node))
95 {
96 if (paddings_to_s32(padv2))
97 changed = true;
98 }
99
100 // TODO add more canonicalization
101 }
102
103 return changed;
104}
PAD in Circle.
Definition CirclePad.h:32
PADV2 in Circle.
Definition CirclePadV2.h:32
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: