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

#include <RemoveUnnecessaryTransposeNetPass.h>

Collaboration diagram for luci::RemoveUnnecessaryTransposeNetPass:

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

Definition at line 25 of file RemoveUnnecessaryTransposeNetPass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 27 of file RemoveUnnecessaryTransposeNetPass.h.

27{ return "luci::RemoveUnnecessaryTransposeNetPass"; }

◆ run()

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

BEFORE

Current pass only targets below cases:

  • 'Reshape' used to reduce N dimension into one (e.g. A x B x C => A x BC) or
  • 'Reshape' devides a single dimension into consecutive N dimensions. (e.g. ABC => A x B x C)
[CircleNode]      [CircleConst]

(in) (perm) \ / [CircleTranspose] [CircleConst] \ (shape) \ / [CircleReshape] [CircleConst] \ (perm) \ / [CircleTranspose] \ \ [CircleNode] (out)

AFTER

[CircleNode] [CircleConst] (in) (shape) \ / [CircleReshape] (new) \ [CircleNode] (out)

Implements logo::Pass.

Examples
/github/workspace/compiler/luci/pass/src/RemoveUnnecessaryTransposeNetPass.cpp.

Definition at line 534 of file RemoveUnnecessaryTransposeNetPass.cpp.

535{
536 bool changed = false;
537
538 for (auto node : loco::active_nodes(loco::output_nodes(g)))
539 {
540 if (auto transpose_node = dynamic_cast<luci::CircleTranspose *>(node))
541 {
542 if (remove_unnecessary_transpose(transpose_node))
543 changed = true;
544 }
545 }
546
547 return changed;
548}
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: