module testing.test_utils.utils_backend_common#

Inheritance diagram of mlprodict.testing.test_utils.utils_backend_common

Short summary#

module mlprodict.testing.test_utils.utils_backend_common

Inspired from sklearn-onnx, handles two backends.

source on GitHub

Classes#

class

truncated documentation

ExpectedAssertionError

Expected failure.

OnnxBackendAssertionError

Expected failure.

OnnxBackendMissingNewOnnxOperatorException

Raised when onnxruntime or mlprodict does not implement a new operator defined in the latest onnx. …

OnnxRuntimeMissingNewOnnxOperatorException

Raised when a new operator was added but cannot be found.

Functions#

function

truncated documentation

_compare_expected

Compares the expected output against the runtime outputs. This is specific to onnxruntime or mlprodict. …

_create_column

Creates a column from values with dtype

_post_process_output

Applies post processings before running the comparison such as changing type from list to arrays.

compare_outputs

Compares expected values and output. Returns None if no error, an exception message otherwise.

evaluate_condition

Evaluates a condition such as StrictVersion(onnxruntime.__version__) <= StrictVersion('0.1.3')

extract_options

Extracts comparison option from filename. As example, Binarizer-SkipDim1 means options SkipDim1 is enabled. …

is_backend_enabled

Tells if a backend is enabled. Raises an exception if backend != ‘onnxruntime’. Unit tests only test models against …

load_data_and_model

Loads every file in a dictionary {key: filename}. The extension is either pkl and onnx and determines how it …

Documentation#

Inspired from sklearn-onnx, handles two backends.

source on GitHub

exception mlprodict.testing.test_utils.utils_backend_common.ExpectedAssertionError#

Bases: Exception

Expected failure.

source on GitHub

exception mlprodict.testing.test_utils.utils_backend_common.OnnxBackendAssertionError#

Bases: AssertionError

Expected failure.

source on GitHub

exception mlprodict.testing.test_utils.utils_backend_common.OnnxBackendMissingNewOnnxOperatorException#

Bases: OnnxBackendAssertionError

Raised when onnxruntime or mlprodict does not implement a new operator defined in the latest onnx.

source on GitHub

exception mlprodict.testing.test_utils.utils_backend_common.OnnxRuntimeMissingNewOnnxOperatorException#

Bases: OnnxBackendAssertionError

Raised when a new operator was added but cannot be found.

source on GitHub

mlprodict.testing.test_utils.utils_backend_common._compare_expected(expected, output, sess, onnx_model, decimal=5, verbose=False, classes=None, **kwargs)#

Compares the expected output against the runtime outputs. This is specific to onnxruntime or mlprodict.

source on GitHub

mlprodict.testing.test_utils.utils_backend_common._create_column(values, dtype)#

Creates a column from values with dtype

mlprodict.testing.test_utils.utils_backend_common._post_process_output(res)#

Applies post processings before running the comparison such as changing type from list to arrays.

source on GitHub

mlprodict.testing.test_utils.utils_backend_common.compare_outputs(expected, output, verbose=False, **kwargs)#

Compares expected values and output. Returns None if no error, an exception message otherwise.

source on GitHub

mlprodict.testing.test_utils.utils_backend_common.evaluate_condition(backend, condition)#

Evaluates a condition such as StrictVersion(onnxruntime.__version__) <= StrictVersion('0.1.3')

source on GitHub

mlprodict.testing.test_utils.utils_backend_common.extract_options(name)#

Extracts comparison option from filename. As example, Binarizer-SkipDim1 means options SkipDim1 is enabled. (1, 2) and (2,) are considered equal. Available options: see dump_data_and_model.

source on GitHub

mlprodict.testing.test_utils.utils_backend_common.is_backend_enabled(backend)#

Tells if a backend is enabled. Raises an exception if backend != ‘onnxruntime’. Unit tests only test models against this backend.

source on GitHub

mlprodict.testing.test_utils.utils_backend_common.load_data_and_model(items_as_dict, **context)#

Loads every file in a dictionary {key: filename}. The extension is either pkl and onnx and determines how it it loaded. If the value is not a string, the function assumes it was already loaded.

source on GitHub