Package ej.microai

Class Tensor.QuantizationParameters

  • Enclosing class:
    Tensor

    public static class Tensor.QuantizationParameters
    extends Object
    The QuantizationParameters class represents the quantization parameters used by a MLInferenceEngine.

    scale and zeroPoint values are 0 when the tensor is not quantized.

    Real values can be quantized using: quantized_value = real_value/scale + zero_point.

    Quantized values can be converted back to float using: real_value = scale * (quantized_value - zero_point).

    • Constructor Detail

      • QuantizationParameters

        public QuantizationParameters​(int zeroPoint,
                                      float scale)
        Creates an instance of QuantizationParameters.
        Parameters:
        zeroPoint - zero point of quantization
        scale - scale of quantization
    • Method Detail

      • getScale

        public float getScale()
        Gets the scale value of the quantization parameters.
        Returns:
        the scale value of the quantization parameters.
      • getZeroPoint

        public int getZeroPoint()
        Gets the zero point value of the quantization parameters.
        Returns:
        the zero point value of the quantization parameters.