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

Class to propagate quantization parameters of an operator's input to output. More...

#include <PropagateQParamForwardPass.h>

Collaboration diagram for luci::PropagateQParamForwardPass:

Public Member Functions

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

Detailed Description

Class to propagate quantization parameters of an operator's input to output.

Definition at line 28 of file PropagateQParamForwardPass.h.

Constructor & Destructor Documentation

◆ PropagateQParamForwardPass() [1/2]

luci::PropagateQParamForwardPass::PropagateQParamForwardPass ( bool  TF_style_maxpool)
inline

Definition at line 30 of file PropagateQParamForwardPass.h.

30: _TF_style_maxpool(TF_style_maxpool) {}

◆ PropagateQParamForwardPass() [2/2]

luci::PropagateQParamForwardPass::PropagateQParamForwardPass ( )
inline

Definition at line 32 of file PropagateQParamForwardPass.h.

32{}

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 34 of file PropagateQParamForwardPass.h.

34{ return "luci::PropagateQParamForwardPass"; }

◆ run()

bool luci::PropagateQParamForwardPass::run ( loco::Graph graph)
finalvirtual

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 173 of file PropagateQParamForwardPass.cpp.

174{
175 bool changed = false;
176 LOGGER(l);
177 for (auto node : loco::active_nodes(loco::output_nodes(g)))
178 {
179 auto circle_node = loco::must_cast<luci::CircleNode *>(node);
180 INFO(l) << "PropagateQParamForwardPass visit node: " << circle_node->name() << std::endl;
181
182 PropagateQParamForward pqp;
183 if (circle_node->accept(&pqp))
184 changed = true;
185
186 if (_TF_style_maxpool)
187 {
188 if (auto maxpool = dynamic_cast<luci::CircleMaxPool2D *>(node))
189 {
190 auto input = loco::must_cast<luci::CircleNode *>(maxpool->value());
191 copy_qparam(input, maxpool);
192 }
193 }
194 }
195
196 return changed;
197}
#define LOGGER(name)
Definition Log.h:65
#define INFO(name)
Definition Log.h:68
MAX_POOL_2D 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(), INFO, LOGGER, and loco::output_nodes().

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


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