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

Class to make negative gamma of batchnorm to a small positive value (1e-10) This pass can change the execution result of the model. So, use it only when the impact is known to be acceptable. More...

#include <MakeBatchNormGammaPositivePass.h>

Collaboration diagram for luci::MakeBatchNormGammaPositivePass:

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 make negative gamma of batchnorm to a small positive value (1e-10) This pass can change the execution result of the model. So, use it only when the impact is known to be acceptable.

Definition at line 30 of file MakeBatchNormGammaPositivePass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 32 of file MakeBatchNormGammaPositivePass.h.

32{ return "luci::MakeBatchNormGammaPositivePass"; }

◆ run()

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

Make negative gamma values of Mul-Add (as BatchNorm) to a small positive value (1e-10)

PATTERN: | [CircleNode] [CircleConst](as gamma) | | [CircleMul] [CircleConst] | | [CircleAdd] |

Implements logo::Pass.

Definition at line 84 of file MakeBatchNormGammaPositivePass.cpp.

85{
86 bool changed = false;
87 for (auto node : loco::active_nodes(loco::output_nodes(g)))
88 {
89 auto add = dynamic_cast<luci::CircleAdd *>(node);
90 if (add == nullptr)
91 continue;
92
93 if (make_positive_gamma(add))
94 changed = true;
95 }
96 return changed;
97}
ADD in Circle.
Definition CircleAdd.h:34
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: