Compute Library
 21.08
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)
 Construct quantization info. More...
 
 QuantizationInfo (std::vector< float > scale)
 Construct quantization info. More...
 
 QuantizationInfo (std::vector< float > scale, std::vector< int32_t > offset)
 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 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 71 of file QuantizationInfo.h.

Constructor & Destructor Documentation

◆ QuantizationInfo() [1/5]

QuantizationInfo ( )
inlinenoexcept

Default constructor.

Definition at line 75 of file QuantizationInfo.h.

76  : _scale(),
77  _offset()
78  {
79  }

◆ QuantizationInfo() [2/5]

QuantizationInfo ( float  scale)
inline

Construct quantization info.

Note
Used for symmetric quantization
Parameters
[in]scaleScale.

Definition at line 86 of file QuantizationInfo.h.

87  : _scale(1, scale), _offset()
88  {
89  }
const std::vector< float > & scale() const
Scale vector accessor.

◆ QuantizationInfo() [3/5]

QuantizationInfo ( float  scale,
int  offset 
)
inline

Construct quantization info.

Note
Used for asymmetric quantization
Parameters
[in]scaleScale.
[in]offsetOffset.

Definition at line 97 of file QuantizationInfo.h.

98  : _scale(1, scale), _offset(1, offset)
99  {
100  }
const std::vector< int32_t > & offset() const
Offset vector accessor.
const std::vector< float > & scale() const
Scale vector accessor.

◆ 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 107 of file QuantizationInfo.h.

108  : _scale(scale), _offset()
109  {
110  }
const std::vector< float > & scale() const
Scale vector accessor.

◆ QuantizationInfo() [5/5]

QuantizationInfo ( std::vector< float >  scale,
std::vector< int32_t >  offset 
)
inline

Construct quantization info.

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

Definition at line 118 of file QuantizationInfo.h.

119  : _scale(scale), _offset(offset)
120  {
121  }
const std::vector< int32_t > & offset() const
Offset vector accessor.
const std::vector< float > & scale() const
Scale vector accessor.

Member Function Documentation

◆ empty()

◆ offset()

const std::vector<int32_t>& offset ( ) const
inline

Offset vector accessor.

Returns
A reference to quantization offset metadata

Definition at line 134 of file QuantizationInfo.h.

Referenced by main(), arm_compute::operator<<(), arm_compute::operator==(), and arm_compute::test::validation::TEST_CASE().

135  {
136  return _offset;
137  }

◆ 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 150 of file QuantizationInfo.h.

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

Referenced by arm_compute::cpu::add_qasymm8_neon(), arm_compute::cpu::add_qasymm8_signed_neon(), arm_compute::cpu::add_qsymm16_neon(), arm_compute::quantization::compute_quantized_multipliers_and_shifts(), ClDequantizeKernel::configure(), ClScaleKernel::configure(), ClWidthConcatenate2TensorsKernel::configure(), ClActivationKernel::configure(), ClHeightConcatenateKernel::configure(), ClPool2dKernel::configure(), ClWidthConcatenateKernel::configure(), ClQuantizeKernel::configure(), CpuScaleKernel::configure(), ClWidthConcatenate4TensorsKernel::configure(), ClBatchConcatenateKernel::configure(), ClDepthConcatenateKernel::configure(), CpuDepthwiseConv2dNativeKernel::configure(), ClLogits1DMaxShiftExpSumKernel::configure(), CLComputeAllAnchorsKernel::configure(), ClDirectConv2dKernel::configure(), CLQLSTMLayerNormalizationKernel::configure(), CLComparisonKernel::configure(), CLReductionOperationKernel::configure(), CLRangeKernel::configure(), CLNormalizePlanarYUVLayerKernel::configure(), CLBoundingBoxTransformKernel::configure(), ClMulKernel::configure(), CLDepthwiseConvolutionLayerNativeKernel::configure(), CLROIPoolingLayerKernel::configure(), CLROIAlignLayerKernel::configure(), ClGemmLowpMatrixMultiplyCore::configure(), ClGemmConvolution::configure(), ClLogits1DNormKernel::configure(), NELSTMLayerQuantized::configure(), CpuGemmLowpMatrixMultiplyCore::configure(), CLGEMMDeconvolutionLayer::configure(), CLLSTMLayerQuantized::configure(), NEQLSTMLayer::configure(), CLQLSTMLayer::configure(), arm_compute::test::validation::convert_from_asymmetric(), 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::cpu::elementwise_comp_quantized_signed(), arm_compute::cpu::elementwise_op_quantized(), arm_compute::cpu::elementwise_op_quantized_signed(), VerifyAccessor< D >::fill_tensor(), arm_compute::test::validation::get_quantized_bounds(), arm_compute::test::validation::get_quantized_qasymm8_signed_bounds(), CpuPool2dAssemblyWrapperKernel::is_configured(), main(), arm_compute::cpu::neon_softmax_logits_1d_quantized(), arm_compute::operator<<(), arm_compute::cpu::poolingMxN_q8_neon_nhwc(), arm_compute::cpu::qasymm8_neon_activation(), arm_compute::cpu::qasymm8_signed_neon_activation(), arm_compute::cpu::qsymm16_neon_activation(), 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::roi_align_1x1_qasymm8(), CPPUpsampleKernel::run(), arm_compute::test::validation::reference::scale(), arm_compute::cpu::sub_qasymm8_neon(), arm_compute::cpu::sub_qasymm8_signed_neon(), arm_compute::cpu::sub_qsymm16_neon(), arm_compute::test::validation::TEST_CASE(), CpuQuantizeKernel::validate(), NEComputeAllAnchorsKernel::validate(), CpuPool2dAssemblyWrapperKernel::validate(), NEBoundingBoxTransformKernel::validate(), ClGemmLowpMatrixMultiplyCore::validate(), ClGemmConvolution::validate(), NEGenerateProposalsLayer::validate(), CpuGemmLowpMatrixMultiplyCore::validate(), NELSTMLayerQuantized::validate(), CLGenerateProposalsLayer::validate(), CLLSTMLayerQuantized::validate(), NEQLSTMLayer::validate(), arm_compute::validate(), and CLQLSTMLayer::validate().

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

The documentation for this class was generated from the following file: