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

Class to remove redundant Reshape node into 1 Reshape node. More...

#include <RemoveRedundantReshapePass.h>

Collaboration diagram for luci::RemoveRedundantReshapePass:

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 remove redundant Reshape node into 1 Reshape node.

This class will update consecutive two Reshape node into single Reshape node. As Reshape operation just change shape, not buffer, former reshape could be unnecessary.

Definition at line 30 of file RemoveRedundantReshapePass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 32 of file RemoveRedundantReshapePass.h.

32{ return "luci::RemoveRedundantReshapePass"; }

◆ run()

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

BEFORE

 [CircleNode]
       |

[CircleReshape_1] | [CircleReshape_2] | [CircleNode]

AFTER

           [CircleNode]
           /          \

[CircleReshape_1] [CircleReshape_2] | [CircleNode]

Implements logo::Pass.

Definition at line 58 of file RemoveRedundantReshape.cpp.

59{
60 bool changed = false;
61 for (auto node : loco::active_nodes(loco::output_nodes(g)))
62 {
63 if (auto reshape_node = dynamic_cast<luci::CircleReshape *>(node))
64 {
65 if (remove_redundant_reshape(reshape_node))
66 changed = true;
67 }
68 }
69 return changed;
70}
RESHAPE 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: