Public Types | |
enum | QuantizationKind { MIN_MAX_QUANTIZATION, L2_MIN_QUANTIZATION, L2_MIN_QUANTIZATION_APPROX, KL_MIN_QUANTIZATION, P99_QUANTIZATION, L1_MIN_QUANTIZATION } |
Public Member Functions | |
TensorQuantizationParams | ChooseQuantizationParams (float min, float max, int precision, bool preserve_sparsity, bool is_signed=false) const |
Choose quantization scale and zero_point that maps floating-point range [min, max] to the integer range of the specified precision. | |
TensorQuantizationParams | ChooseQuantizationParams (float min, float max, bool is_weight=false) const |
Choose quantization scale and zero_point that maps floating-point range [min, max] to the default integer range of this quantization factory. | |
TensorQuantizationParams | ChooseQuantizationParams (const float *values, int len, QuantizationKind kind, int precision, bool preserve_sparsity) const |
Choose quantization based on the values in an array to optimize the quantization errors ignoring a few outliers. More... | |
TensorQuantizationParams | ChooseQuantizationParams (const float *values, int len, bool is_weight=false) const |
TensorQuantizationParams | ChooseQuantizationParams (const Histogram &hist, QuantizationKind kind, int precision, bool preserve_sparsity) const |
Choose quantization based on histogram of values to optimize the quantization errors ignoring a few outliers. | |
TensorQuantizationParams | ChooseQuantizationParams (const Histogram &hist, bool is_weight=false) const |
RequantizationParams | ChooseRequantizationMultiplier (float real_multiplier, TensorQuantizationParams target_qparams) const |
int | GetActivationPrecision () const |
int | GetWeightPrecision () const |
int | GetEltwiseQuantizePrecision () const |
bool | GetPreserveActivationSparsity () const |
bool | GetPreserveWeightSparsity () const |
QuantizationKind | GetActivationKind () const |
QuantizationKind | GetWeightKind () const |
QuantizationFactory (int activation_precision=8, int weight_precision=8, int requantization_multiplier_precision=32, int eltwise_quantize_precision=16, bool preserve_activation_sparsity=false, bool preserve_weight_sparsity=false, bool force_scale_power_of_two=false, QuantizationKind activation_kind=MIN_MAX_QUANTIZATION, QuantizationKind weight_kind=MIN_MAX_QUANTIZATION) | |
Static Public Member Functions | |
static QuantizationFactory * | GetDefaultInstance () |
Get the default factory whose policy is determined by gflags. | |
TensorQuantizationParams dnnlowp::QuantizationFactory::ChooseQuantizationParams | ( | const float * | values, |
int | len, | ||
QuantizationKind | kind, | ||
int | precision, | ||
bool | preserve_sparsity | ||
) | const |
Choose quantization based on the values in an array to optimize the quantization errors ignoring a few outliers.
Ajust the granularity of histogram collection to the quantization precision. Use 8x more number of bins in the histogram should be sufficient for linear quantization.
Definition at line 210 of file dnnlowp.cc.