module testing.test_utils.utils_backend_common
#
Short summary#
module mlprodict.testing.test_utils.utils_backend_common
Inspired from sklearn-onnx, handles two backends.
Classes#
class |
truncated documentation |
---|---|
Expected failure. |
|
Expected failure. |
|
Raised when onnxruntime or mlprodict does not implement a new operator defined in the latest onnx. … |
|
Raised when a new operator was added but cannot be found. |
Functions#
function |
truncated documentation |
---|---|
Compares the expected output against the runtime outputs. This is specific to onnxruntime or mlprodict. … |
|
Creates a column from values with dtype |
|
Applies post processings before running the comparison such as changing type from list to arrays. |
|
Compares expected values and output. Returns None if no error, an exception message otherwise. |
|
Evaluates a condition such as |
|
Extracts comparison option from filename. As example, |
|
Tells if a backend is enabled. Raises an exception if backend != ‘onnxruntime’. Unit tests only test models against … |
|
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.
- exception mlprodict.testing.test_utils.utils_backend_common.ExpectedAssertionError#
Bases:
Exception
Expected failure.
- exception mlprodict.testing.test_utils.utils_backend_common.OnnxBackendAssertionError#
Bases:
AssertionError
Expected failure.
- 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.
- exception mlprodict.testing.test_utils.utils_backend_common.OnnxRuntimeMissingNewOnnxOperatorException#
Bases:
OnnxBackendAssertionError
Raised when a new operator was added but cannot be found.
- 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.
- 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.
- 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.
- mlprodict.testing.test_utils.utils_backend_common.evaluate_condition(backend, condition)#
Evaluates a condition such as
StrictVersion(onnxruntime.__version__) <= StrictVersion('0.1.3')
- 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: seedump_data_and_model
.
- 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.
- 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.