Package ej.microai

Class Tensor.QuantizationParameters

  • Enclosing class:
    Tensor

    public static class Tensor.QuantizationParameters
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      QuantizationParameters​(int zeroPoint, float scale)
      Creates an instance of QuantizationParameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float getScale()
      Gets the scale value of the quantization parameters.
      int getZeroPoint()
      Gets the zero point value of the quantization parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.