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

Class to remove redundant dequantize operations. More...

#include <RemoveRedundantDequantizePass.h>

Collaboration diagram for luci::RemoveRedundantDequantizePass:

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 remove redundant dequantize operations.

Definition at line 28 of file RemoveRedundantDequantizePass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 30 of file RemoveRedundantDequantizePass.h.

30{ return "luci::RemoveRedundantDequantizePass"; }

◆ run()

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

Dequantize Op does the below things on the ifm.

  1. Element-wise update of quantized values (u8/s16) to fp32 values
  2. Update dtype to fp32 If the previous node is not quantized, dequantize Op is redundant.

BEFORE

[CircleNode (A)]
       |
[CircleNode (B)] (fp32)
       |

[CircleDequantize] | [CircleNode]

AFTER

[CircleNode (A)]
       |
[CircleNode (B)] (fp32)
       |
  [CircleNode]

Implements logo::Pass.

Definition at line 65 of file RemoveRedundantDequantizePass.cpp.

66{
67 bool changed = false;
68 for (auto node : loco::active_nodes(loco::output_nodes(g)))
69 {
70 auto target_node = dynamic_cast<luci::CircleDequantize *>(node);
71 if (target_node != nullptr)
72 {
73 if (remove_redundant_dequant(target_node))
74 changed = true;
75 }
76 }
77 return changed;
78}
DEQUANTIZE 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(), and loco::output_nodes().

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


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