ONE - On-device Neural Engine
Loading...
Searching...
No Matches
logo::ResolveDuplicateReshapePass Class Referencefinal

Resolve duplicated Reshape nodes in a row. More...

#include <ResolveDuplicateReshapePass.h>

Collaboration diagram for logo::ResolveDuplicateReshapePass:

Public Member Functions

const char * name (void) const final
 
bool run (loco::Graph *graph) override
 Run the pass.
 
- Public Member Functions inherited from logo::Pass
virtual ~Pass ()=default
 

Detailed Description

Resolve duplicated Reshape nodes in a row.

Definition at line 30 of file ResolveDuplicateReshapePass.h.

Member Function Documentation

◆ name()

const char * logo::ResolveDuplicateReshapePass::name ( void  ) const
inlinefinalvirtual

Reimplemented from logo::Pass.

Definition at line 33 of file ResolveDuplicateReshapePass.h.

33{ return "ResolveDuplicateReshapePass"; }

◆ run()

bool logo::ResolveDuplicateReshapePass::run ( loco::Graph graph)
overridevirtual

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 88 of file ResolveDuplicateReshapePass.cpp.

89{
90 auto outputs = loco::output_nodes(graph);
91
92 bool changed = false;
93 for (auto node : loco::postorder_traversal(outputs))
94 {
95 if (is_duplicate_reshape(node))
96 {
97 auto node_as_reshape = loco::must_cast<loco::FixedReshape *>(node);
98
99 remap_input(node_as_reshape);
100
101 changed = true;
102 }
103 }
104
105 return changed;
106}
std::vector< loco::Node * > postorder_traversal(const std::vector< loco::Node * > &roots)
Generate postorder traversal sequence starting from "roots".
Definition Algorithm.cpp:53
std::vector< Node * > output_nodes(Graph *)
Definition Graph.cpp:101

References loco::output_nodes(), and loco::postorder_traversal().

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


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