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

Class to quantize ONNXDequantizeLinear operator. More...

#include <QuantizeOnnxDequantizeLinearPass.h>

Collaboration diagram for luci::QuantizeOnnxDequantizeLinearPass:

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 quantize ONNXDequantizeLinear operator.

Definition at line 29 of file QuantizeOnnxDequantizeLinearPass.h.

Member Function Documentation

◆ name()

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

Reimplemented from logo::Pass.

Definition at line 31 of file QuantizeOnnxDequantizeLinearPass.h.

31{ return "luci::QuantizeOnnxDequantizeLinear"; }

◆ run()

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

Quantize pattern

[Before]

 [CircleConst(quantized)]
           |

[CircleCustom(OnnxDequantizeLinear)] | [CircleNode]

[After]

    [CircleConst(quantized)]
           |
      [CircleNode]

Implements logo::Pass.

Definition at line 410 of file QuantizeOnnxDequantizeLinearPass.cpp.

411{
412 bool changed = false;
413
414 for (auto node : loco::active_nodes(loco::output_nodes(g)))
415 {
416 if (auto circle_custom_out = dynamic_cast<luci::CircleCustomOut *>(node))
417 {
418 OnnxDequantizeLinearPattern p(circle_custom_out);
419 if (p.matched())
420 {
421 QuantizeOnnxDequantizeLinear quantize(p);
422 quantize.apply();
423 changed = true;
424 }
425 }
426 }
427
428 return changed;
429}
Virtual CIRCLECUSTOMOUT 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
std::vector< T > quantize(const float *data, size_t num_elements, float scale, int32_t zero_point)
Definition TestUtils.h:174

References loco::active_nodes(), and loco::output_nodes().

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


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