module onnxrt.ops_cpu.op_dequantize_linear#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_dequantize_linear

Short summary#

module mlprodict.onnxrt.ops_cpu.op_dequantize_linear

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

DequantizeLinear

DequantizeLinear ================ The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero …

Properties#

property

truncated documentation

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default_modified

Returns the list of modified parameters.

args_mandatory

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

atts_value

Returns all parameters in a dictionary.

Methods#

method

truncated documentation

__init__

_run

Documentation#

Runtime operator.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_dequantize_linear.DequantizeLinear(onnx_node, desc=None, **options)#

Bases: OpRun

The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero point to compute the full precision tensor. The dequantization formula is y = (x - x_zero_point) * x_scale. ‘x_scale’ and ‘x_zero_point’ must have same shape, and can be either a scalar for per-tensor / per layer quantization, or a 1-D tensor for per-axis quantization. ‘x_zero_point’ and ‘x’ must have same type. ‘x’ and ‘y’ must have same shape. In the case of dequantizing int32, there’s no zero point (zero point is supposed to be 0).

Attributes

  • axis: (Optional) The axis of the dequantizing dimension of the input tensor. Ignored for per-tensor quantization. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(input). Default value is nameaxisi1typeINT (INT)

Inputs

Between 2 and 3 inputs.

  • x (heterogeneous)T: N-D quantized input tensor to be de-quantized.

  • x_scale (heterogeneous)tensor(float): Scale for input ‘x’. It can be a scalar, which means a per-tensor/layer dequantization, or a 1-D tensor for per-axis dequantization.

  • x_zero_point (optional, heterogeneous)T: Zero point for input ‘x’. Shape must match x_scale. It’s optional. Zero point is 0 when it’s not specified.

Outputs

  • y (heterogeneous)tensor(float): N-D full precision output tensor. It has same shape as input ‘x’.

Type Constraints

  • T tensor(int8), tensor(uint8), tensor(int32): Constrain ‘x_zero_point’ and ‘x’ to 8-bit/32-bit integer tensor.

Version

Onnx name: DequantizeLinear

This version of the operator has been available since version 13.

Runtime implementation: DequantizeLinear

__init__(onnx_node, desc=None, **options)#
_run(*args, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub