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

Quantize non-const activaion using pre-defined scale/zp for special Ops. More...

#include <QuantizeActivation.h>

Collaboration diagram for luci::QuantizeSpecialActivation:

Public Member Functions

 QuantizeSpecialActivation (loco::DataType output)
 
void visit (luci::CircleNode *node)
 Default fallback.
 
void visit (luci::CircleLogistic *node)
 
void visit (luci::CircleTanh *node)
 
void visit (luci::CircleSoftmax *node)
 
void visit (luci::CircleFloor *node)
 
void visit (luci::CircleFloorDiv *node)
 
void visit (luci::CircleFloorMod *node)
 
void visit (luci::CircleCeil *node)
 
- Public Member Functions inherited from luci::CircleNodeMutableVisitor< void >
virtual ~CircleNodeMutableVisitor ()=default
 
- Public Member Functions inherited from luci::CircleNodeMutableVisitorBase< T >
virtual ~CircleNodeMutableVisitorBase ()=default
 

Data Fields

loco::DataType output_type
 

Detailed Description

Quantize non-const activaion using pre-defined scale/zp for special Ops.

Definition at line 41 of file QuantizeActivation.h.

Constructor & Destructor Documentation

◆ QuantizeSpecialActivation()

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

Definition at line 43 of file QuantizeActivation.h.

43: output_type(output) {}

Member Function Documentation

◆ visit() [1/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleCeil node)

Definition at line 158 of file QuantizeActivation.cpp.

159{
161 set_int_scale(node);
162}
ActivationQType activation_qtype(const CircleNode *node)
void set_int_scale(luci::CircleNode *node)

References luci::activation_qtype(), luci::IntScale, and luci::set_int_scale().

◆ visit() [2/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleFloor node)

Definition at line 140 of file QuantizeActivation.cpp.

141{
143 set_int_scale(node);
144}

References luci::activation_qtype(), luci::IntScale, and luci::set_int_scale().

◆ visit() [3/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleFloorDiv node)

Definition at line 146 of file QuantizeActivation.cpp.

147{
149 set_int_scale(node);
150}

References luci::activation_qtype(), luci::IntScale, and luci::set_int_scale().

◆ visit() [4/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleFloorMod node)

Definition at line 152 of file QuantizeActivation.cpp.

153{
155 set_int_scale(node);
156}

References luci::activation_qtype(), luci::IntScale, and luci::set_int_scale().

◆ visit() [5/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleLogistic node)

Definition at line 119 of file QuantizeActivation.cpp.

120{
122 node->quantparam());
123 node->quantparam(std::move(qparam));
124}
@ PreDefinedLogistic
std::unique_ptr< CircleQuantParam > make_predefined_qparam(ActivationQType qtype, loco::DataType dtype, CircleQuantParam *old_quant_param)
CircleQuantParam * quantparam(void) const

References luci::make_predefined_qparam(), output_type, luci::PreDefinedLogistic, and luci::CircleNode::quantparam().

◆ visit() [6/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleNode )
virtual

Default fallback.

Reimplemented from luci::CircleNodeMutableVisitor< void >.

Definition at line 107 of file QuantizeActivation.cpp.

108{
109 // Nodes fused with activation functions which need special quantization
110 auto fused_act_node = dynamic_cast<CircleNodeMixin<CircleNodeTrait::FusedActFunc> *>(node);
111 if (fused_act_node != nullptr && fused_act_node->fusedActivationFunction() == FusedActFunc::TANH)
112 {
114 node->quantparam());
115 node->quantparam(std::move(qparam));
116 }
117}

References luci::make_predefined_qparam(), output_type, luci::PreDefinedTanh, luci::CircleNode::quantparam(), and luci::TANH.

◆ visit() [7/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleSoftmax node)

◆ visit() [8/8]

void luci::QuantizeSpecialActivation::visit ( luci::CircleTanh node)

Field Documentation

◆ output_type

loco::DataType luci::QuantizeSpecialActivation::output_type

Definition at line 45 of file QuantizeActivation.h.

Referenced by visit(), visit(), visit(), and visit().


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