openvino.runtime.opset13.fake_quantize

openvino.runtime.opset13.fake_quantize(data: Union[openvino._pyopenvino.Node, int, float, numpy.ndarray], input_low: Union[openvino._pyopenvino.Node, int, float, numpy.ndarray], input_high: Union[openvino._pyopenvino.Node, int, float, numpy.ndarray], output_low: Union[openvino._pyopenvino.Node, int, float, numpy.ndarray], output_high: Union[openvino._pyopenvino.Node, int, float, numpy.ndarray], levels: int, auto_broadcast: str = 'NUMPY', name: Optional[str] = None) openvino._pyopenvino.Node

Perform an element-wise linear quantization on input data.

Parameters
  • data – The node with data tensor.

  • input_low – The node with the minimum for input values.

  • input_high – The node with the maximum for input values.

  • output_low – The node with the minimum quantized value.

  • output_high – The node with the maximum quantized value.

  • levels – The number of quantization levels. Integer value.

  • auto_broadcast – The type of broadcasting specifies rules used for auto-broadcasting of input tensors.

Returns

New node with quantized value.

Input floating point values are quantized into a discrete set of floating point values.

if x <= input_low:
    output = output_low
if x > input_high:
    output = output_high
else:
    output = fake_quantize(output)

Fake quantize uses the following logic:

f[ output =

dfrac{round( dfrac{data - input_low}{(input_high - input_low)cdot (levels-1)})} {(levels-1)cdot (output_high - output_low)} + output_low f]