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

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

#include <PropagateQParamBackwardPass.h>

Collaboration diagram for luci::PropagateQParamBackwardPass:

Public Member Functions

 PropagateQParamBackwardPass (loco::DataType output)
 
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 output to input.

Definition at line 28 of file PropagateQParamBackwardPass.h.

Constructor & Destructor Documentation

◆ PropagateQParamBackwardPass()

luci::PropagateQParamBackwardPass::PropagateQParamBackwardPass ( loco::DataType  output)
inline

Definition at line 30 of file PropagateQParamBackwardPass.h.

30: _output_model_dtype(output) {}

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 32 of file PropagateQParamBackwardPass.h.

32{ return "luci::PropagateQParamBackwardPass"; }

◆ run()

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

Run the pass.

Returns
false if there was nothing changed

Implements logo::Pass.

Definition at line 521 of file PropagateQParamBackwardPass.cpp.

522{
523 LOGGER(l);
524
525 // We use reverse post-order traversal as qparam is propagated backward
527 std::reverse(nodes.begin(), nodes.end());
528 for (auto node : nodes)
529 {
530 auto circle_node = loco::must_cast<luci::CircleNode *>(node);
531 INFO(l) << "PropagateQParamBackwardPass visit node: " << circle_node->name() << std::endl;
532
533 // We can't propagate non-existent qparam
534 if (circle_node->quantparam() == nullptr)
535 continue;
536
537 PropagateQParamBackward pqb;
538 circle_node->accept(&pqb);
539 }
540
541 // This pass is only run once, so return false
542 // TODO Refactoring not to return meaningless value
543 return false;
544}
#define LOGGER(name)
Definition Log.h:65
#define INFO(name)
Definition Log.h:68
std::vector< loco::Node * > postorder_traversal(const std::vector< loco::Node * > &roots)
Generate postorder traversal sequence starting from "roots".
Definition Algorithm.cpp:53
std::vector< Node * > output_nodes(Graph *)
Definition Graph.cpp:101

References INFO, LOGGER, loco::output_nodes(), and loco::postorder_traversal().

Referenced by package.infer.session::inference(), and luci::QuantizeWithMinMaxPass::run().


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