module testing.test_utils.quantized_tensor#

Inheritance diagram of mlprodict.testing.test_utils.quantized_tensor

Short summary#

module mlprodict.testing.test_utils.quantized_tensor

Initializes a quantized tensor from float values.

source on GitHub

Classes#

class

truncated documentation

QuantizedBiasTensor

Instantiates a quantized tensor (uint8) with bias from a float tensor.

QuantizedTensor

Instantiates a quantized tensor (uint8) from a float tensor.

Functions#

function

truncated documentation

test_qlinear_conv

Checks a runtime for operator QLinearConv.

Methods#

method

truncated documentation

__init__

__init__

constructor

_init

Initialization when dtype is float32.

Documentation#

Initializes a quantized tensor from float values.

source on GitHub

class mlprodict.testing.test_utils.quantized_tensor.QuantizedBiasTensor(data, X_or_scale, W: QuantizedTensor | None = None)#

Bases: object

Instantiates a quantized tensor (uint8) with bias from a float tensor.

Parameters:

source on GitHub

__init__(data, X_or_scale, W: QuantizedTensor | None = None)#
class mlprodict.testing.test_utils.quantized_tensor.QuantizedTensor(data, scale=None, zero_point=None)#

Bases: object

Instantiates a quantized tensor (uint8) from a float tensor.

Parameters:
  • data – array

  • scale – scale if data.dtype is float32, None otherwise

  • zero_point – zero_point if data.dtype is float32, None otherwise

source on GitHub

constructor

__init__(data, scale=None, zero_point=None)#

constructor

_init(data)#

Initialization when dtype is float32.

mlprodict.testing.test_utils.quantized_tensor.test_qlinear_conv(x: QuantizedTensor, x_shape, w: QuantizedTensor, w_shape, b: QuantizedBiasTensor, y: QuantizedTensor, y_shape, opset=None, runtime='python', pads=None, strides=None, group=None)#

Checks a runtime for operator QLinearConv.

Parameters:
  • xQuantizedTensor

  • x_shape – shape of X

  • wQuantizedTensor

  • w_shape – shape of W

  • bQuantizedBiasTensor or None

  • y – expected output, QuantizedTensor or None

  • y_shape – shape of Y

  • opset – desired onnx opset

  • runtime – runtime for OnnxInference

  • pads – optional parameter for operator QLinearConv

  • strides – optional parameter for operator QLinearConv

  • group – optional paramerer for operator QLinearConv

source on GitHub