validation.bench_trees¶
onnx_extended.validation.bench_trees.bench_trees¶
- onnx_extended.validation.bench_trees.bench_trees(max_depth: int = 14, n_estimators: int = 100, n_features: int = 100, batch_size=10000, number: int = 10, warmup: int = 2, verbose: int = 0, engine_names: List[str] | None = None, repeat: int = 2, profile: bool = False) List[Dict[str, Any]] [source]¶
Measures the performances of the different implements of the TreeEnsemble.
- Parameters:
max_depth – depth of tree
n_estimators – number of trees in the forest
n_features – number of features
batch_size – batch size
number – number of calls to measure
warmup – number of calls before starting the measure
verbose – verbosity
engine_names – see below
repeat – number of times to repeat the measure
profile – run a profiler as well
- Returns:
list of observations
Possible choices:
onnxruntime: simple onnxruntime.InferenceSession
onnxruntime-customop: onnxruntime.InferenceSession with a custom implementation for the trees
CReferenceEvaluator:
onnx_extended.reference.CReferenceEvaluator
cython: cython wrapper for the onnxruntime shared libraries
cython-customop: cython wrapper for the onnxruntime shared libraries with a custom implementation for the trees
onnx_extended.validation.bench_trees.create_decision_tree¶
- onnx_extended.validation.bench_trees.create_decision_tree(n_features: int = 100, max_depth: int = 14) ModelProto [source]¶
onnx_extended.validation.bench_trees.create_engine¶
- onnx_extended.validation.bench_trees.create_engine(name: str, onx: ModelProto, feeds: Dict[str, ndarray]) Engine [source]¶
Creates engines to benchmark a random forest.
- Parameters:
name – name of the engine, see below
onx – the model
feeds – the inputs
- Returns:
an instance of
Engine
Possible choices:
onnxruntime: simple onnxruntime.InferenceSession
onnxruntime-customop: onnxruntime.InferenceSession with a custom implementation for the trees
CReferenceEvaluator:
onnx_extended.reference.CReferenceEvaluator
cython: cython wrapper for the onnxruntime shared libraries
cython-customop: cython wrapper for the onnxruntime shared libraries with a custom implementation for the trees
onnx_extended.validation.bench_trees.Engine¶
onnx_extended.validation.bench_trees.EngineCython¶
- class onnx_extended.validation.bench_trees.EngineCython(name: str, sess: Any)[source]¶
Same interface as InferenceSession but for
OrtSession
.