ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnc::FuseArithmeticOps Class Reference

Main purpose of this pass - is to fuse 'Conv->BatchNorm' into 'Conv' Currently 'BatchNorm' split by NNC frontends into 'Scale->Scale->BiasAdd' This optimization performs in two steps (repeated while graph changing): More...

#include <FuseArithmeticOps.h>

Collaboration diagram for nnc::FuseArithmeticOps:

Public Member Functions

PassData run (PassData data) override
 run compiler pass
 
std::string getName () override
 
- Public Member Functions inherited from nnc::Pass
virtual void cleanup ()
 clean compiler pass data
 
virtual ~Pass ()=default
 

Detailed Description

Main purpose of this pass - is to fuse 'Conv->BatchNorm' into 'Conv' Currently 'BatchNorm' split by NNC frontends into 'Scale->Scale->BiasAdd' This optimization performs in two steps (repeated while graph changing):

  1. Fuse two successive operations with constant weights into one (ex: 'Scale->Scale' becomes 'Scale')
  2. Sink 'BiasAdd' through 'Scale' (so 'Conv->BiasAdd->Scale' becomes 'Conv->Scale->BiasAdd')

Definition at line 34 of file FuseArithmeticOps.h.

Member Function Documentation

◆ getName()

std::string nnc::FuseArithmeticOps::getName ( )
inlineoverridevirtual

Reimplemented from nnc::Pass.

Definition at line 39 of file FuseArithmeticOps.h.

39{ return "FuseArithmeticOps"; }

◆ run()

nnc::PassData nnc::FuseArithmeticOps::run ( PassData  data)
overridevirtual

run compiler pass

Parameters
data- data that pass is taken
Returns
data that can be passed to the next pass
Exceptions
PassExceptionobject if errors occured

Implements nnc::Pass.

Definition at line 235 of file FuseArithmeticOps.cpp.

236{
237 auto g = static_cast<Graph *>(data);
238
239 bool graph_changed = true;
240 while (graph_changed)
241 {
242 graph_changed = false;
243 graph_changed |= fuseSuccessiveOps(g);
244 graph_changed |= sinkAddThroughMul(g);
245 }
246
247 return g;
248}

Referenced by package.infer.session::inference().


The documentation for this class was generated from the following files: