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

#include <FuseHorizontalFullyConnectedPass.h>

Collaboration diagram for luci::FuseHorizontalFullyConnectedPass:

Public Member Functions

const char * name (void) const final
 
bool run (loco::Graph *g) final
 Class to fuse horizontal FC layers.
 
- Public Member Functions inherited from logo::Pass
virtual ~Pass ()=default
 

Detailed Description

Definition at line 25 of file FuseHorizontalFullyConnectedPass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 27 of file FuseHorizontalFullyConnectedPass.h.

27{ return "luci::FuseHorizontalFullyConnectedPass"; }

◆ run()

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

Class to fuse horizontal FC layers.

Before

+-— [In] -—+ | | V V fc1 (w1, b1) fc2 (w2, b2) | | | | +—> add <-—+ | V [Out]

After

[In] | V fc3 (w1+w2, b1+b2) | V [Out]

Shape/dtype of fc1, fc2, and fc3 should be the same.

Implements logo::Pass.

Definition at line 202 of file FuseHorizontalFullyConnectedPass.cpp.

203{
204 bool changed = false;
205 for (auto node : loco::active_nodes(loco::output_nodes(g)))
206 {
207 auto add_node = dynamic_cast<CircleAdd *>(node);
208 if (not add_node)
209 continue;
210
211 if (fuse_horizontal_fc_nodes(add_node))
212 changed = true;
213 }
214
215 return changed;
216}
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: