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

Class to fold AddV2 to a constant tensor. More...

#include <FoldAddV2Pass.h>

Collaboration diagram for luci::FoldAddV2Pass:

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 fold AddV2 to a constant tensor.

Definition at line 29 of file FoldAddV2Pass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 31 of file FoldAddV2Pass.h.

31{ return "luci::FoldAddV2Pass"; }

◆ run()

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

Constant Folding for AddV2 Op

Implements logo::Pass.

Definition at line 98 of file FoldAddV2Pass.cpp.

99{
100 bool changed = false;
101 for (auto node : loco::active_nodes(loco::output_nodes(g)))
102 {
103 if (auto custom = dynamic_cast<luci::CircleCustom *>(node))
104 {
105 if (custom->custom_code() == "AddV2")
106 {
107 // TODO: Support more data types
108 if (custom->dtype() == loco::DataType::S64)
109 {
110 if (fold_add_v2<loco::DataType::S64>(custom))
111 changed = true;
112 }
113 }
114 }
115 }
116
117 return changed;
118}
CUSTOM 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: