CMSIS-DSP  
CMSIS DSP Software Library
 
Loading...
Searching...
No Matches
Int8Quantization Class Reference

Public Member Functions

template<typename T>
void constrain_scale (T &scale) const noexcept
 Keep learned scales in the numerically safe, strictly-positive range.
 
template<typename T>
void constrain_zero_point (T &zero_point) const noexcept
 
template<typename T>
void constrain_parameters (T *scales, T *zero_points) const noexcept
 Project all learned parameters into this backend quantization scheme.
 

Static Public Member Functions

static constexpr Int8Quantization activation () noexcept
 Per-tensor asymmetric activation quantization.
 
static constexpr Int8Quantization weights (std::size_t axis_size, std::size_t inner_size) noexcept
 

Description

LiteRT/CMSIS-NN/Ethos-U signed int8 quantization layout.

Member Function Documentation

◆ activation()

static constexpr Int8Quantization activation ( )
inlinestaticconstexprnoexcept

Per-tensor asymmetric activation quantization.

Returns
Asymmetric int8 layout with one scale and zero-point per tensor.

◆ constrain_parameters()

template<typename T>
void constrain_parameters ( T * scales,
T * zero_points ) const
inlinenoexcept

Project all learned parameters into this backend quantization scheme.

Template Parameters
TQuantization parameter scalar type.
Parameters
[in,out]scalesArray of parameter_count() learned scales.
[in,out]zero_pointsArray of parameter_count() learned zero-points.

◆ constrain_scale()

template<typename T>
void constrain_scale ( T & scale) const
inlinenoexcept

Keep learned scales in the numerically safe, strictly-positive range.

Template Parameters
TScale scalar type.
Parameters
[in,out]scaleLearned scale to constrain.

◆ constrain_zero_point()

template<typename T>
void constrain_zero_point ( T & zero_point) const
inlinenoexcept

Keep learned zero-points in this scheme's integer domain. Symmetric weight quantization always forces them to zero.

Template Parameters
TZero-point scalar type.
Parameters
[in,out]zero_pointLearned zero-point to constrain.

◆ weights()

static constexpr Int8Quantization weights ( std::size_t axis_size,
std::size_t inner_size )
inlinestaticconstexprnoexcept

Symmetric per-axis weight quantization.

Parameters
axis_sizeNumber of scales along the quantized axis.
inner_sizeProduct of dimensions following the quantized axis.
Returns
Symmetric int8 layout with one scale per axis entry.

axis_size is the number of scales and inner_size is the product of the dimensions following the quantized axis in a row-major tensor. Thus a fully-connected [output, input] matrix uses (output, input), Conv2D OHWI uses (output, H*W*I), and depthwise Conv2D uses (channels, 1).