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

Class to remove unnecessary Reshape nodes. More...

#include <RemoveUnnecessaryReshapeNetPass.h>

Collaboration diagram for luci::RemoveUnnecessaryReshapeNetPass:

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 unnecessary Reshape nodes.

This class will remove unnecessary pre/post-Reshape nodes. See https://github.com/Samsung/ONE/issues/9600 for more details.

Definition at line 30 of file RemoveUnnecessaryReshapeNetPass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 32 of file RemoveUnnecessaryReshapeNetPass.h.

32{ return "luci::RemoveUnnecessaryReshapeNetPass"; }

◆ run()

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

BEFORE

 [CircleNode]
       |

[CircleReshape_1] (shape: A -> B) | [CircleNode] (ex: Add/Mul/Tanh/Logistic ..) | [CircleReshape_2] (shape: B -> A) | [CircleNode]

AFTER

 [CircleNode]
       |   \
       |   [CircleReshape_1]
 [CircleNode]
       |   \
       |   [CircleReshape_2]
 [CircleNode]

Implements logo::Pass.

Definition at line 159 of file RemoveUnnecessaryReshapeNetPass.cpp.

160{
161 bool changed = false;
162 for (auto node : loco::active_nodes(loco::output_nodes(g)))
163 {
164 if (auto reshape_node = dynamic_cast<luci::CircleReshape *>(node))
165 {
166 if (remove_unnecessary_reshape_net(reshape_node))
167 changed = true;
168 }
169 }
170 return changed;
171}
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: