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

Class to Forward send Reshape after UnaryOp. More...

#include <ForwardReshapeToUnaryOpPass.h>

Collaboration diagram for luci::ForwardReshapeToUnaryOpPass:

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 Forward send Reshape after UnaryOp.

Definition at line 28 of file ForwardReshapeToUnaryOpPass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 30 of file ForwardReshapeToUnaryOpPass.h.

30{ return "luci::ForwardReshapeToUnaryOpPass"; }

◆ run()

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

BEFORE | [CircleNode] [CircleConst] | / [CircleReshape] / | [CircleNode] [(UnaryOp)] | | \ | | [CircleNode] | | |

UnaryOp: CircleNeg, ... Note: Binary Op (Div, Mul) can also be considered as a unary operation if one of its inputs is a constant. For CircleMean in which the axis is a scalar constant and reshape Op does not change the axis on which the mean is taken, the Reshape Op can be forwarded.

AFTER | [CircleConst] [CircleNode] | / | [CircleReshape] [(UnaryOp)] [CircleConst] | | / [CircleNode] [CircleReshape] | | \ | | [CircleNode] | | |

Note: new [CircleReshape] after [(UnaryOp)] added

Implements logo::Pass.

Definition at line 436 of file ForwardReshapeToUnaryOpPass.cpp.

437{
438 bool changed = false;
439 ForwardReshape forward;
440 for (auto node : loco::active_nodes(loco::output_nodes(g)))
441 {
442 auto circle_node = loco::must_cast<luci::CircleNode *>(node);
443 if (circle_node->accept(&forward))
444 changed = true;
445 }
446 return changed;
447}
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: