Compute Library
 24.04
QuantizationInfo Class Reference

Quantization information. More...

#include <QuantizationInfo.h>

Public Member Functions

 QuantizationInfo () noexcept
 Default constructor. More...
 
 QuantizationInfo (float scale)
 Construct quantization info. More...
 
 QuantizationInfo (float scale, int offset, bool is_dynamic=false)
 Construct quantization info. More...
 
 QuantizationInfo (std::vector< float > scale)
 Construct quantization info. More...
 
 QuantizationInfo (std::vector< float > scale, std::vector< int32_t > offset, bool is_dynamic=false)
 Construct quantization info. More...
 
const std::vector< float > & scale () const
 Scale vector accessor. More...
 
const std::vector< int32_t > & offset () const
 Offset vector accessor. More...
 
bool is_dynamic () const
 is_dynamic accessor More...
 
bool empty () const
 Indicates whether this QuantizationInfo has valid settings or not. More...
 
UniformQuantizationInfo uniform () const
 Return per layer quantization info. More...
 

Detailed Description

Quantization information.

Definition at line 67 of file QuantizationInfo.h.

Constructor & Destructor Documentation

◆ QuantizationInfo() [1/5]

QuantizationInfo ( )
inlinenoexcept

Default constructor.

Definition at line 71 of file QuantizationInfo.h.

71  : _scale(), _offset()
72  {
73  }

◆ QuantizationInfo() [2/5]

QuantizationInfo ( float  scale)
inline

Construct quantization info.

Note
Used for symmetric quantization
Parameters
[in]scaleScale.

Definition at line 80 of file QuantizationInfo.h.

80  : _scale(1, scale), _offset()
81  {
82  }

◆ QuantizationInfo() [3/5]

QuantizationInfo ( float  scale,
int  offset,
bool  is_dynamic = false 
)
inline

Construct quantization info.

Note
Used for asymmetric quantization
Parameters
[in]scaleScale.
[in]offsetOffset.
[in]is_dynamicWhether this QuantizationInfo is dynamic, i.e. the scale and offset may change.

Definition at line 91 of file QuantizationInfo.h.

92  : _scale(1, scale), _offset(1, offset), _is_dynamic(is_dynamic)
93  {
94  }

◆ QuantizationInfo() [4/5]

QuantizationInfo ( std::vector< float >  scale)
inline

Construct quantization info.

Note
Used for symmetric per channel quantization
Parameters
[in]scaleScale.

Definition at line 101 of file QuantizationInfo.h.

101  : _scale(scale), _offset()
102  {
103  }

◆ QuantizationInfo() [5/5]

QuantizationInfo ( std::vector< float >  scale,
std::vector< int32_t >  offset,
bool  is_dynamic = false 
)
inline

Construct quantization info.

Note
Used for asymmetric per channel quantization
Parameters
[in]scaleScale.
[in]offsetOffset.
[in]is_dynamicWhether this QuantizationInfo is dynamic, i.e. the scale and offset may change.

Definition at line 112 of file QuantizationInfo.h.

113  : _scale(scale), _offset(offset), _is_dynamic(is_dynamic)
114  {
115  }

Member Function Documentation

◆ empty()

◆ is_dynamic()

bool is_dynamic ( ) const
inline

is_dynamic accessor

Returns
If true, the scale and offset may change, so operators will need to read on every run

Definition at line 136 of file QuantizationInfo.h.

137  {
138  return _is_dynamic;
139  }

Referenced by CpuGemmLowpMatrixMultiplyCore::configure(), invert_qinfo_offset(), CpuGemmLowpMatrixMultiplyCore::run(), and CpuGemmLowpMatrixMultiplyCore::validate().

◆ offset()

◆ scale()

◆ uniform()

UniformQuantizationInfo uniform ( ) const
inline

Return per layer quantization info.

Returns
Uniform quantization information in case of empty information zero is returned in the respective fields

Definition at line 152 of file QuantizationInfo.h.

153  {
154  UniformQuantizationInfo uqinfo;
155  uqinfo.scale = _scale.empty() ? 0 : _scale[0];
156  uqinfo.offset = _offset.empty() ? 0 : _offset[0];
157 
158  return uqinfo;
159  }

References UniformQuantizationInfo::offset, and UniformQuantizationInfo::scale.

Referenced by arm_compute::cpu::add_qasymm8_signed_sve2(), arm_compute::cpu::add_qasymm8_sve2(), arm_compute::cpu::add_qsymm16_neon(), arm_compute::cpu::add_qsymm16_sve2(), arm_compute::cpu::add_sub_q8_neon_fixedpoint_possible(), arm_compute::cpu::add_sub_qasymm8_neon(), arm_compute::cpu::add_sub_qasymm8_signed_neon(), arm_compute::cpu::avg_poolingMxNxD_q8_neon_ndhwc(), arm_compute::cpu::bounding_box_transform_qsymm16(), arm_compute::cpu::compute_all_anchors_qasymm16(), arm_compute::quantization::compute_quantized_multipliers_and_shifts(), ClTransposedConvolutionKernel::configure(), ClMatMulLowpNativeMMULKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClMatMulLowpNativeKernel::configure(), NEQLSTMLayerNormalizationKernel::configure(), CLComputeAllAnchorsKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLComparisonKernel::configure(), CLRangeKernel::configure(), ClDirectConv2dKernel::configure(), ClDirectConv3dKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLBoundingBoxTransformKernel::configure(), CLROIPoolingLayerKernel::configure(), CLROIAlignLayerKernel::configure(), ClGemmLowpMatrixMultiplyCore::configure(), NELSTMLayerQuantized::configure(), CpuGemmLowpMatrixMultiplyCore::configure(), CLGEMMDeconvolutionLayer::configure(), NEQLSTMLayer::configure(), CLLSTMLayerQuantized::configure(), CLQLSTMLayer::configure(), arm_compute::test::validation::convert_to_asymmetric(), arm_compute::test::validation::convert_to_symmetric(), Qasymm8QuantizationHelper< QUANTIZED_TYPE >::dequantize(), arm_compute::dequantize_qasymm16(), arm_compute::dequantize_qsymm16(), arm_compute::dequantize_s32(), arm_compute::cpu::directconv3d_quantized_neon_ndhwc(), arm_compute::cpu::elementwise_arithmetic_quantized_op(), arm_compute::cpu::elementwise_comp_quantized_signed(), arm_compute::cpu::elementwise_comparison_quantized_op(), arm_compute::cpu::elementwise_op< int8_t >(), arm_compute::cpu::elementwise_op< uint8_t >(), arm_compute::cpu::elementwise_op_quantized(), arm_compute::cpu::elementwise_op_quantized_signed(), arm_compute::quantization::get_quantized_asymmetric_output_min_max(), arm_compute::test::validation::get_quantized_bounds(), arm_compute::test::validation::get_quantized_qasymm8_signed_bounds(), main(), arm_compute::cpu::max_poolingMxNxD_q8_neon_ndhwc(), arm_compute::cpu::neon_qasymm8_meanstddevnorm(), arm_compute::cpu::neon_softmax_non_x_quantized(), arm_compute::cpu::neon_softmax_x_quantized(), arm_compute::operator<<(), arm_compute::cpu::poolingMxN_q8_neon_nhwc(), arm_compute::test::validation::reference::quantization_layer(), Qasymm8QuantizationHelper< QUANTIZED_TYPE >::quantize(), arm_compute::quantize_qasymm16(), arm_compute::quantize_qsymm16(), arm_compute::quantize_qsymm8(), arm_compute::cpu::roi_align_1x1_qasymm8(), CPPUpsampleKernel::run(), CpuGemmLowpMatrixMultiplyCore::run(), arm_compute::cpu::sub_qsymm16_neon(), arm_compute::test::validation::suggest_mac_dst_q_info_and_bias(), arm_compute::cpu::sve2_softmax_logits_1d_quantized(), ClGemmLowpMatrixMultiplyCore::validate(), NEGenerateProposalsLayer::validate(), CpuGemmLowpMatrixMultiplyCore::validate(), NELSTMLayerQuantized::validate(), CLGenerateProposalsLayer::validate(), CLLSTMLayerQuantized::validate(), NEQLSTMLayer::validate(), arm_compute::validate(), and CLQLSTMLayer::validate().


The documentation for this class was generated from the following file:
arm_compute::QuantizationInfo::is_dynamic
bool is_dynamic() const
is_dynamic accessor
Definition: QuantizationInfo.h:136
arm_compute::QuantizationInfo::scale
const std::vector< float > & scale() const
Scale vector accessor.
Definition: QuantizationInfo.h:120
arm_compute::QuantizationInfo::offset
const std::vector< int32_t > & offset() const
Offset vector accessor.
Definition: QuantizationInfo.h:128