module external.onnxruntime_perf

Inheritance diagram of pymlbenchmark.external.onnxruntime_perf

Short summary

module pymlbenchmark.external.onnxruntime_perf

Implements a benchmark about performance for onnxruntime

source on GitHub

Classes

class

truncated documentation

OnnxRuntimeBenchPerfTest

Specific test to compare computing time predictions with scikit-learn and onnxruntime. See example …

Methods

method

truncated documentation

__init__

_get_random_dataset

Returns a random datasets.

_init

Finalizes the init.

data

Generates random features.

extract_model_info_onnx

Populates member self.onnx_info with additional information on the ONNX graph.

extract_model_info_skl

Populates member self.skl_info with additional information on the model such as the number of node for …

model_info

Returns additional informations about a model.

validate

Checks that methods predict and predict_proba returns the same results for both scikit-learn and …

Documentation

Implements a benchmark about performance for onnxruntime

source on GitHub

class pymlbenchmark.external.onnxruntime_perf.OnnxRuntimeBenchPerfTest(estimator, dim=None, N_fit=100000, runtimes=('python_compiled', 'onnxruntime1'), onnx_options=None, dtype=<class 'numpy.float32'>, **opts)

Bases: BenchPerfTest

Specific test to compare computing time predictions with scikit-learn and onnxruntime. See example Benchmark of onnxruntime on LogisticRegression. The class requires the following modules to be installed: onnx, onnxruntime, skl2onnx, mlprodict.

source on GitHub

Parameters:
  • estimator – estimator class

  • dim – number of features

  • N_fit – number of observations to fit an estimator

  • runtimes – runtimes to test for class OnnxInference

  • opts – training settings

  • onnx_options – ONNX conversion options

  • dtype – dtype (float32 or float64)

source on GitHub

__init__(estimator, dim=None, N_fit=100000, runtimes=('python_compiled', 'onnxruntime1'), onnx_options=None, dtype=<class 'numpy.float32'>, **opts)
Parameters:
  • estimator – estimator class

  • dim – number of features

  • N_fit – number of observations to fit an estimator

  • runtimes – runtimes to test for class OnnxInference

  • opts – training settings

  • onnx_options – ONNX conversion options

  • dtype – dtype (float32 or float64)

source on GitHub

_get_random_dataset(N, dim)

Returns a random datasets.

source on GitHub

_init(onx, runtimes)

Finalizes the init.

data(N=None, dim=None, **kwargs)

Generates random features.

Parameters:
  • N – number of observations

  • dim – number of features

source on GitHub

extract_model_info_onnx(**kwargs)

Populates member self.onnx_info with additional information on the ONNX graph.

source on GitHub

extract_model_info_skl(**kwargs)

Populates member self.skl_info with additional information on the model such as the number of node for a decision tree.

source on GitHub

model_info(model)

Returns additional informations about a model.

Parameters:

model – model to describe

Returns:

dictionary with additional descriptor

source on GitHub

validate(results, **kwargs)

Checks that methods predict and predict_proba returns the same results for both scikit-learn and onnxruntime.

source on GitHub