ONE - On-device Neural Engine
Loading...
Searching...
No Matches
moco::ResolveFusedBatchNorm Class Reference

Trasform TFFusedBatchNorm into TFAdd + TFRsqrt + TFMul + TFBatchNorm. More...

#include <ResolveFusedBatchNorm.h>

Collaboration diagram for moco::ResolveFusedBatchNorm:

Public Member Functions

const char * name (void) const final
 
bool run (loco::Graph *graph) override
 Run the pass.
 
- Public Member Functions inherited from logo::Pass
virtual ~Pass ()=default
 

Detailed Description

Trasform TFFusedBatchNorm into TFAdd + TFRsqrt + TFMul + TFBatchNorm.

Definition at line 30 of file ResolveFusedBatchNorm.h.

Member Function Documentation

◆ name()

const char * moco::ResolveFusedBatchNorm::name ( void  ) const
inlinefinalvirtual

Reimplemented from logo::Pass.

Definition at line 33 of file ResolveFusedBatchNorm.h.

33{ return "ResolveFusedBatchNorm"; }

◆ run()

bool moco::ResolveFusedBatchNorm::run ( loco::Graph graph)
overridevirtual

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 236 of file ResolveFusedBatchNorm.cpp.

237{
238 for (auto node : loco::active_nodes(loco::output_nodes(graph)))
239 {
240 if (as<moco::TFFusedBatchNorm>(node))
241 {
242 if (resolve_to_muladd(graph, as<moco::TFFusedBatchNorm>(node)))
243 {
244 // tree has been changed. let's return so that we don't need to
245 // considier about following node is correct or not.
246 return true;
247 }
248 }
249 }
250
251 return false;
252}
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 class was generated from the following files: