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

Class to Substitute Transpose with certain input shape condition to single reshape node. More...

#include <SubstituteTransposeToReshapePass.h>

Collaboration diagram for luci::SubstituteTransposeToReshapePass:

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 Substitute Transpose with certain input shape condition to single reshape node.

Definition at line 28 of file SubstituteTransposeToReshapePass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 30 of file SubstituteTransposeToReshapePass.h.

30{ return "luci::SubstituteTransposeToReshapePass"; }

◆ run()

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

BEFORE

[CircleNode]  [CircleConst]
     \             /
     [CircleTranspose]
            |
       [CircleNode]

AFTER

[CircleNode]  [CircleConst]
      \             /
     [CircleReshape]
            |
       [CircleNode]

Implements logo::Pass.

Definition at line 122 of file SubstituteTransposeToReshapePass.cpp.

123{
124 bool changed = false;
125 for (auto node : loco::active_nodes(loco::output_nodes(g)))
126 {
127 if (auto circle_node = dynamic_cast<luci::CircleTranspose *>(node))
128 {
129 if (substitute_transpose_to_reshape(circle_node))
130 {
131 changed = true;
132 }
133 }
134 }
135 return changed;
136}
TRANSPOSE in Circle.
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: