Functions#

Summary#

function

class parent

truncated documentation

ClassFactory

Dynamically creates a class for a specific operator.

OnnxReduceAnyApi18

Adds operator Reduce* with opset>=18 following API from opset 17.

OnnxReduceL2_typed

Adds operator ReduceL2 for float or double.

OnnxReduceMeanApi18

Adds operator ReduceMean with opset>=18 following API from opset 17.

OnnxReduceSumApi11

Adds operator ReduceSum with opset>=13 following API from opset 12.

OnnxReduceSumSquareApi18

Adds operator ReduceSumSquare with opset>=18 following API from opset 17.

OnnxReshapeApi13

Adds operator Reshape with opset>=14 following API from opset 13.

OnnxSplitApi11

Adds operator Split with opset>=13 following API from opset 11.

OnnxSqueezeApi11

Adds operator Squeeze with opset>=13 following API from opset 11.

OnnxUnsqueezeApi11

Adds operator Unsqueeze with opset>=13 following API from opset 11.

_1d_problem

__pep8

_additional_imports

Adds additional imports for experimental models.

_analyse_tree

Extract information from a tree.

_analyse_tree_h

Extract information from a tree in a HistGradientBoosting.

_append_succ_pred

_append_succ_pred_s

_apply_adagrad

_apply_adam

_apply_einsum_matmul

Decomposes the generic matrix multiplication into numpy operations depending on the operator to use for matrix multiplication …

_apply_momentum

_apply_optimisation_on_graph

Applies an optimisation function fct on a graph and not on the model.

_apply_remove_node_fct_node

Applies an optimizing function on a subgraphs.

_apply_squeeze_transpose

Puts output dimension in the expected order.

_apply_transpose_reshape

Put all dimensions in the same order.

_argmax

_argmax_use_numpy_select_last_index

_argmin

_argmin_use_numpy_select_last_index

_array_feature_extrator

Implementation of operator ArrayFeatureExtractor with numpy.

_asv_class_name

_basic_verification

_batchnorm_test_mode

_batchnorm_training_mode

_build_schemas

_call_conv_runtime_opset

_call_runtime

Private.

_call_validate

_capture_output

_cartesian

From https://stackoverflow.com/a/1235363 Generate a cartesian product of input arrays. Parameters ———- …

_cfft

_change_subgraph_io_type_shape_list

_check_data_field

_check_dtype

_check_expression

_check_field

_check_function

_check_graph

_check_map

_check_model

_check_model_local_functions

_check_node

_check_opset_compatibility

_check_optional

_check_run_benchmark

_check_sequence

_check_sparse_tensor

_check_sparse_tensor_indices_1

Check that the index data stored in a SparseTensorProto is valid. indices: a 1-dimensional tensor; indices[i] represents …

_check_sparse_tensor_indices_2

Check that the index data stored in a SparseTensorProto is valid. indices: a 2-dimensional tensor; indices[i,j] represents …

_check_tensor

_check_value_info

_cifft

_clean_initializer_name

_clean_operator_name

_clean_script

Comments out all lines containing .show().

_clean_values_optim

_clean_variable_name

_common_check_numpy_extended_dot

Common verifications for all implementations of numpy_extended_dot().

_common_converter_begin

_common_converter_int_t

_common_converter_t

_common_shape_calculator_int_t

_common_shape_calculator_t

_compare_expected

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

_compress_nodes

Compresses a sequence of node to make it more readable. If possible, it creates a node Expression with a graph …

_compress_nodes_once

Compresses a sequence of node to make it more readable. If possible, it creates a node Expression with a graph …

_compute_negative_log_likelihood_loss

Modified version of softmaxcrossentropy.py

_concat

_concat_from_sequence

_convert_sklearn_svm_classifier

Converter for model SVC, NuSVC. …

_converter_classifier

Default converter for a classifier with one input and two outputs, label and probabilities of the same input type. …

_converter_cluster

Default converter for a clustering with one input and two outputs, label and distances of the same input type. It …

_converter_regressor

Default converter for a regressor with one input and one output of the same type. It assumes instance operator

_converter_transformer

Default converter for a transformer with one input and one output of the same type. It assumes instance operator

_coor_to_str

_copy_attributes

_copy_inout

_copy_value_info_proto

_create_asv_benchmark_file

Creates a benchmark file based in the information received through the argument. It uses one of the templates like …

_create_column

Creates a column from values with dtype

_create_node_id

_cubic_coeffs

_custom_parser_xgboost

Custom parser for XGBClassifier and LGBMClassifier.

_decompose_einsum_equation_simple

Applies strategy simple, numpy defined in by function decompose_einsum_equation().

_default_OPSET_TO_IR_VERSION

Returns the default mapping between opset and ir_version.

_dict2str

_dictionary2str

_display_code_lines

_dispsimple

_dofit_model

_domain_to_class_name

Converts domain into a name.

_download_url

_dropout

_dynamic_class_creation

Automatically generates classes for each of the operators module onnx defines and described at Operators

_edit_distance

_einsum

_elem_type_as_str

_element_unary

Infers shape for an element wise operator. The function returns but updates known_shapes.

_element_wise

Infers shape for an element wise operator. The function returns but updates known_shapes.

_enforce_has_field

_enforce_has_repeated_field

_enforce_non_empty_field

_enumerate_asv_benchmark_all_models

Loops over all possible models and fills a folder with benchmarks following asv concepts.

_enumerate_classes

Extracts the classes of a file.

_enumerate_fit_info

Extracts the name of the fitted models and the data used to train it.

_enumerate_validated_operator_opsets_ops

_enumerate_validated_operator_opsets_version

_fft

_figures2dict

Converts the data from list to dictionaries.

_finalize

_find_operator_domain

Determines the domain of an operator. Raises an exception if not found or if there is an ambiguity.

_fix_opset_skl2onnx

_fix_tree_ensemble

_fix_tree_ensemble_node

Fixes a node for old versionsof skl2onnx.

_format_dict

Formats a dictionary as code.

_fuse_node

Merges two nodes having one input/output in common.

_gather_nd_impl

Modified version of softmaxcrossentropy.py. …

_generate_op_doc

_get_all_coords

_get_all_operator_schema

_get_all_schemas_with_history

_get_doc_template

_get_doc_template

_get_indices

_get_info_lgb

Get informations from and lightgbm trees.

_get_info_xgb

Get informations from and lightgbm trees.

_get_neighbor

_get_neighbor_idxes

_get_new_name

_get_onnx_function

Returns the list of functions defined in ONNX package.

_get_output_shape

_get_output_shape_no_ceil

_get_pad_shape

_get_problem_data

_get_shape

_get_type

_get_typed_class_attribute

Converts an attribute into a C++ value.

_get_version_for_domain

_global_average_pool

_global_max_pool

_guess_noshape

_guess_s2o_type

_guess_type

_guess_type_

_handle_init_files

Returns created, location_model, prefix_import.

_has_decision_function

_has_predict_proba

_has_transform_model

_hash_obj_content

Hash the content of an object.

_ifft

_infer_node_output

Infers node outputs for a specific type.

_insert_diff

Splits a using split, insert HTML differences between pieces. The function relies on package pyquickhelper. …

_internal_decorator

_internal_method_decorator

_interpolate_1d_with_x

_interpolate_nd

_interpolate_nd_with_x

_is_out

_is_rotation

_istft

Reverses of stft.

_jsonify

_layer_normalization

_leaky_relu

_leaky_relu_inplace

_linear_coeffs

_make_att_graph

_make_callable

Same function as make_callable() but deals with function which an undefined number of arguments.

_make_einsum_model

_make_inputs

_make_node

Constructs a NodeProto.

_make_opset

_measure_time

Measures the execution time for a function.

_measure_time

Measures a statement and returns the results as a dictionary.

_merge_initial_types

_merge_options

_model_name

Extracts the main component of a model, removes suffixes such Classifier, Regressor, CV.

_modify_dimension

Modifies the number of features to increase or reduce the number of features.

_multiply_time_kwargs

Multiplies values in time_kwargs following strategy time_kwargs_fact for a given model inst.

_nearest_coeffs

_new_options

_nodes

_noshapevar

_numpy_array

Single function to create an array.

_numpy_dot_inplace_left

Subpart of @see fn numpy_dot_inplace.

_numpy_dot_inplace_right

Subpart of @see fn numpy_dot_inplace.

_numpy_extended_dot_equation

Returns the equation equivalent to an extended version of an aligned matrix multiplication (see numpy_extended_dot()). …

_numpy_extended_dot_python_intermediate

_numpy_extended_dot_python_l1l2l3

_numpy_extended_dot_python_update_broadcast

_one_hot

_onnx_function_to_model_convert_io

_onnx_inline_function_graph

_onnx_inline_function_node

_op_type_domain_classifier

Defines op_type and op_domain based on dtype.

_op_type_domain_classifier

Defines op_type and op_domain based on dtype.

_op_type_domain_regressor

Defines op_type and op_domain based on dtype.

_op_type_domain_regressor

Defines op_type and op_domain based on dtype.

_pad_impl

_parse_data

_parse_node

Parses nodes.

_parse_tree_structure

The pool of all nodes’ indexes created when parsing a single tree. Different tree use different pools.

_pool

_pool_get_output_shape

_pool_impl

_populate__get_all_schemas_with_history

_populate_schemas

Populates all schemas.

_post_process_output

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

_private_get_file

Retrieves one template.

_problem_for_cl_decision_function

Returns X, y, intial_types, method, name, X runtime for a scoring problem. It is based on Iris dataset.

_problem_for_cl_decision_function_binary

Returns X, y, intial_types, method, name, X runtime for a scoring problem. Binary classification. It is based …

_problem_for_clnoproba

Returns X, y, intial_types, method, name, X runtime for a scoring problem. It is based on Iris dataset.

_problem_for_clnoproba_binary

Returns X, y, intial_types, method, name, X runtime for a scoring problem. Binary classification. It is based …

_problem_for_clustering

Returns X, intial_types, method, name, X runtime for a clustering problem. It is based on Iris dataset.

_problem_for_clustering_scores

Returns X, intial_types, method, name, X runtime for a clustering problem, the score part, not the cluster. It …

_problem_for_dict_vectorizer

Returns a problem for the sklearn.feature_extraction.DictVectorizer.

_problem_for_feature_hasher

Returns a problem for the sklearn.feature_extraction.DictVectorizer.

_problem_for_label_encoder

Returns a problem for the sklearn.preprocessing.LabelEncoder.

_problem_for_mixture

Returns X, y, intial_types, method, node name, X runtime for a m-cl classification problem. It is based on Iris …

_problem_for_numerical_scoring

Returns X, y, intial_types, method, name, X runtime for a scoring problem. It is based on Iris dataset.

_problem_for_numerical_trainable_transform

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_numerical_trainable_transform_cl

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_numerical_transform

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_numerical_transform_positive

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_one_hot_encoder

Returns a problem for the sklearn.preprocessing.OneHotEncoder.

_problem_for_outlier

Returns X, intial_types, method, name, X runtime for a transformation problem. It is based on Iris dataset.

_problem_for_predictor_binary_classification

Returns X, y, intial_types, method, node name, X runtime for a binary classification problem. It is based on Iris …

_problem_for_predictor_multi_classification

Returns X, y, intial_types, method, node name, X runtime for a m-cl classification problem. It is based on Iris …

_problem_for_predictor_multi_classification_label

Returns X, y, intial_types, method, node name, X runtime for a m-cl classification problem. It is based on Iris …

_problem_for_predictor_multi_regression

Returns X, y, intial_types, method, name, X runtime for a mregression problem. It is based on Iris dataset.

_problem_for_predictor_regression

Returns X, y, intial_types, method, name, X runtime for a regression problem. It is based on Iris dataset.

_problem_for_tfidf_transformer

Returns a problem for the :epkg:`sklearn:feature_extraction:text:TfidfTransformer`.

_problem_for_tfidf_vectorizer

Returns a problem for the :epkg:`sklearn:feature_extraction:text:TfidfVectorizer`.

_process_node

_python_make_node

_python_make_node_graph

Translates a GraphProto into python.

_python_make_node_if

Translates a node If into python.

_python_make_node_loop

Translates a node Loop into python.

_python_make_node_make_attribute_str

_python_make_node_name

_python_make_node_scan

Translates a node Scan into python.

_random_input

_raw_score_binary_classification

_read_patterns

Reads the testing pattern.

_reduce_infos

Produces agregates features.

_register_converters_lightgbm

This functions registers additional converters for lightgbm.

_register_converters_mlinsights

This functions registers additional converters for mlinsights.

_register_converters_skl2onnx

This functions registers additional converters for skl2onnx.

_register_converters_xgboost

This functions registers additional converters for xgboost.

_relu

_rename_graph_input

Renames an input and adds an Identity node to connect the dots.

_rename_graph_output

Renames an output and adds an Identity node to connect the dots.

_rename_node_input

Renames an input from a node.

_rename_node_output

Renames an output from a node.

_rename_var

_replace

_replace_tensor_type

_retrieve_class_parameters

Imports files in bdir, compile files and extra metadata from them.

_retrieve_problems_extra

Use by enumerate_compatible_opset().

_run_skl_prediction

_save_model_dump

_scatter_nd_impl

_select_close_float

Selects the closest float to x. It returns always numpy.float32(x).

_select_pattern_problem

Selects a benchmark type based on the problem kind.

_shape_calculator_classifier

Default shape calculator for a classifier with one input and two outputs, label (int64) and probabilites of the same …

_shape_calculator_cluster

Default shape calculator for a clustering with one input and two outputs, label (int64) and distances of the same type. …

_shape_calculator_regressor

Default shape calculator for a regressor with one input and one output of the same type.

_shape_calculator_transformer

Default shape calculator for a transformer with one input and one output of the same type.

_shape_exc

_side_by_side_by_values_inputs

_skl2onnx_add_to_container

Adds ONNX graph to skl2onnx container and scope.

_sklearn_subfolder

Returns the list of subfolders for a model.

_slice

_sparse_array

Single function to create an sparse array (coo_matrix).

_specify_int64

_split_op_name

_split_tree_ensemble_atts

Splits the attributes of a TreeEnsembleRegressor into multiple trees in order to do the summation in double instead …

_stft

Applies one dimensional FFT with window weights. torch defines the number of frames as: n_frames = 1 + (len - n_fft) / hop_length. …

_summary_report_indices

_switch_axes

_to_array

_to_onnx_function_column_transformer

_to_onnx_function_pipeline

_translate_split_criterion

_try_onnx

Tries onnx conversion.

_type_to_string

Converts a type into a readable string.

_unsqueeze

_update_module

Dynamically updates the module with operators defined by ONNX.

_update_test_metadata

_validate_runtime_dict

_validate_runtime_separate_process

_var_as_dict

Converts a protobuf object into something readable. The current implementation relies on json. That’s not …

_vcelu1

_xop_make_node_name

abs

See numpy.abs().

acos

See numpy.acos().

acosh

See numpy.acosh().

add_model_import_init

Modifies a template such as TemplateBenchmarkClassifier with code associated to the model model.

add_onnx_graph

Adds a whole ONNX graph to an existing one following skl2onnx API assuming this ONNX graph implements an …

amax

See numpy.amax().

amin

See numpy.amin().

analyse_einsum_equation

Analyses an einsum equation.

analyze_model

Returns informations, statistics about a model, its number of nodes, its size…

annotate_heatmap

Annotates a heatmap. See plot_benchmark_metrics() for an example.

apply_einsum_sequence

Applies a sequence of operations on a list of inputs. The sequence of operations is produced by function decompose_einsum_equation(). …

arange

See numpy.arange(), start, stop must be specified.

argmax

See numpy.argmax().

argmax_use_numpy_select_last_index

Needed or operator ArgMax.

argmin

See numpy.argmin().

argmin_use_numpy_select_last_index

Needed or operator ArgMin.

array_feature_extrator

Implementation of operator ArrayFeatureExtractor with numpy.

asin

See numpy.asin().

asinh

See numpy.asinh().

assert_almost_equal_string

Compares two arrays knowing they contain strings. Raises an exception if the test fails.

astype_range

Computes ranges for every number in an array once converted into float32. The function returns two matrices which …

asv2csv

Converts results produced by asv into csv.

asv_bench

Creates an asv benchmark in a folder but does not run it.

atan

See numpy.atan().

atanh

See numpy.atanh().

benchmark_doc

Runs the benchmark published into the documentation (see Availability of scikit-learn model for runtime onnxruntime1 and Availability of scikit-learn model for runtime python_compiled). …

benchmark_fct

Benchmarks a function which takes an array as an input and changes the number of rows.

benchmark_replay

The command rerun a benchmark if models were stored by command line vaidate_runtime.

binary_array_to_string

Used to compare decision path.

build_custom_scenarios

Defines parameters values for some operators.

build_custom_scenarios

Defines parameters values for some operators.

build_key_split

Used for documentation.

cache_folder

Returns this folder.

calculate_lightgbm_output_shapes

Shape calculator for LightGBM Booster (see lightgbm).

ceil

See numpy.ceil().

change_input_first_dimension

Some models are converted under the assumption batch prediction is not necessary. This function changes the first …

change_input_type

Changes the type of an input.

change_style

Switches from AaBb into aa_bb.

change_style

Switches from AaBb into aa_bb.

change_style

Switches from AaBb into aa_bb.

change_subgraph_io_type_shape

Changes the type of an input or an output of a subgraph.

check

Checks the library is working. It raises an exception. If you want to disable the logs:

check_attribute

NB: This is a generic “attribute well-formedness” check, it doesn’t actually test if an attribute is valid per a schema. …

check_is_almost_equal

Checks that two floats or two arrays are almost equal.

check_is_experimental_op

Tells if an operator is experimentation.

check_model

Checks a model is consistent with ONNX language. The function fails if the model is not consistent.

check_model_representation

Checks that a trained model can be exported in a specific list of formats and produces the same outputs if the representation …

check_onnx

Checks consistency of the model.

check_type

Raises an exception if the model is not of the expected type.

classifier

Returns any classifier from scikit-learn converted into ONNX assuming a converter is registered with sklearn-onnx. …

clean_error_msg

Removes EOL from error messages in dataframes.

clip

See numpy.clip().

cluster

Returns any cluster from scikit-learn converted into ONNX assuming a converter is registered with sklearn-onnx. …

col2im_indices

Source im2col.py.

col2im_nchw

C implementation of a partial col2im.

common_reference_implementation

compare_backend

The function compares the expected output (computed with the model before being converted to ONNX) and the ONNX output. …

compare_outputs

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

compare_runtime

The function compares the expected output (computed with the model before being converted to ONNX) and the ONNX output …

compare_runtime

The function compares the expected output (computed with the model before being converted to ONNX) and the ONNX output …

compare_runtime_session

The function compares the expected output (computed with the model before being converted to ONNX) and the ONNX output …

compile_c_function

Compiles a C function with cffi. It takes one features vector.

compose_page_onnxrt_ops

Writes page Python Runtime for ONNX operators.

compress

See numpy.compress(). numpy.compress(condition, x) or npnx.compress(x, condition).

compress_proto

Compresses a ModelProto, FunctionProto, :epkg:`GraphProto`. The function detects nodes outputting …

compute_benchmark

Compares the processing time several functions.

compute_transposition_features

Given a shape and a permutation, computes many features used to predict the cost of the transposition.

concat

Operator concat, handle numpy.vstack() and numpy.hstack().

convert_lightgbm

This converters reuses the code from LightGbm.py

convert_model

Runs the appropriate conversion method.

convert_score_cdist_sum

Converts function score_cdist_sum() into ONNX.

convert_scorer

Converts a scorer into ONNX assuming there exists a converter associated to it. The function wraps the function …

convert_transfer_transformer

Converters for TransferTransformer.

convert_validate

Converts a model stored in pkl file and measure the differences between the model and the ONNX predictions.

convert_xgboost

This converters reuses the code from XGBoost.py

converter_lightgbm_concat

Converter for operator LightGBMConcat.

copy_value_info

Makes a copy of onnx.ValueInfoProto.

cos

See numpy.cos().

cosh

See numpy.cosh().

create_asv_benchmark

Creates an asv benchmark in a folder but does not run it.

create_tensor

Creates a tensor.

cst

Creates a constant. log(x) + numpy.float32(1) works but numpy.float32(32) + log(x) fails because Python calls …

cumsum

See numpy.cumsum().

custom_einsum

Experimental implementation of operator Einsum when it does a matrix multiplication. Case: bsnh,btnh->bnts with …

custom_pad

Implements function pad in python, only …

custom_scorer_transform_converter

Selects the appropriate converter for a @see cl CustomScorerTransform.

custom_scorer_transform_parser

This function updates the inputs and the outputs for a @see cl CustomScorerTransform.

custom_scorer_transform_shape_calculator

Computes the output shapes for a @see cl CustomScorerTransform.

debug_dump

Dumps an object for debug purpose.

debug_onnx_object

__dict__ is not in most of onnx objects. This function uses function dir to explore this object.

debug_print

Displays informations on an object.

decompose_einsum_equation

Decomposes an equation used in numpy.einsum knowing the input shapes. It returns a sequence of operations …

default_time_kwargs

Returns default values number and repeat to measure the execution of a function.

det

See numpy.linalg:det().

device_to_providers

Returns the corresponding providers for a specific device.

dgemm_dot

dgemm_dot(double[:,

display_onnx

Returns a shortened string of the model.

dot

See numpy.dot()

download_model_data

Downloads a model and returns a link to the local ONNX file and data which can be used as inputs.

dtype_name

Returns the name of a numpy dtype.

dump_binary_classification

Trains and dumps a model for a binary classification problem. The function trains a model and calls dump_data_and_model(). …

dump_booster_model

Dumps Booster to JSON format. Parameters ———- self: booster num_iteration : int or None, optional …

dump_data_and_model

Saves data with pickle, saves the model with pickle and onnx, runs and saves the predictions for the given model. …

dump_into_folder

Dumps information when an error was detected using pickle.

dump_lgbm_booster

Dumps a Lightgbm booster into JSON.

dump_multilabel_classification

Trains and dumps a model for a binary classification problem. The function trains a model and calls dump_data_and_model(). …

dump_multiple_classification

Trains and dumps a model for a binary classification problem. The function trains a model and calls dump_data_and_model(). …

dump_multiple_regression

Trains and dumps a model for a multi regression problem. The function trains a model and calls dump_data_and_model(). …

dump_one_class_classification

Trains and dumps a model for a One Class outlier problem. The function trains a model and calls dump_data_and_model(). …

dump_single_regression

Trains and dumps a model for a regression problem. The function trains a model and calls dump_data_and_model(). …

dynamic_doc

Generates the documentation for ONNX operators.

einsum

See numpy.einsum().

einsum

Proposes a new implementation of numpy.einsum. It does not allow expresion using and expects a right …

einsum_benchmark

Investigates whether or not the decomposing einsum is faster.

einsum_test

Investigates whether or not the decomposing einsum is faster.

empty_shape_calculator

Does nothing.

ensure_topological_order

Ensures and modifies the order of nodes to have a topological order (every node in the list can only be an input …

enumerate_benchmark_replay

Replays a benchmark stored with function enumerate_validated_operator_opsets

enumerate_cached_einsum

Enumerates all cached einsum function.

enumerate_compatible_opset

Lists all compatible opsets for a specific model.

enumerate_export_asv_json

Looks into asv results and wraps all of them into a dataframe or flat data.

enumerate_fitted_arrays

Enumerate all fitted arrays included in a scikit-learn object.

enumerate_model_node_outputs

Enumerates all the nodes of a model.

enumerate_models

Enumerates models with models.

enumerate_onnx_names

Enumerates all existing names in one ONNX graph (ModelProto, FunctionProto, :epkg:`GraphProto`). …

enumerate_onnx_nodes

Enumerates all nodes in one ONNX graph (ModelProto, FunctionProto, :epkg:`GraphProto`). The function …

enumerate_onnx_tests

Collects test from a sub folder of onnx/backend/test. Works as an enumerator to start processing them without …

enumerate_pipeline_models

Enumerates all the models within a pipeline.

enumerate_random_inputs

Enumerates random matrices.

enumerate_validated_operator_opsets

Tests all possible configurations for all possible operators and returns the results.

enumerate_visual_onnx_representation_into_rst

Returns content for pages such as linear_model.

erf

See scipy.special.erf.

evaluate_condition

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

exp

See numpy.exp().

expand_dims

See numpy.expand_dims().

expand_onnx_options

Expands shortened options. Long names hide some part of graphs in asv benchmark. This trick converts a string …

expit

See scipy.special.expit.

export2cpp

Exports an ONNX model to the :epkg:`c` syntax.

export2numpy

Exports an ONNX model to the numpy syntax. The exports does not work with all operators.

export2onnx

Exports an ONNX model to the onnx syntax.

export2python

Exports an ONNX model to the python syntax.

export2tf2onnx

Exports an ONNX model to the tensorflow-onnx syntax.

export2xop

Exports an ONNX model to the XOP syntax.

export_asv_json

Looks into asv results and wraps all of them into a dataframe or flat data.

export_template

Exports an ONNX model to the onnx syntax.

extract_information_from_filename

Returns a dictionary with information extracted from a filename. An example is better:

extract_options

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

filter_rows

Used for documentation.

find_missing_sklearn_imports

Finds in scikit-learn the missing pieces.

find_node_input_name

Finds a node input by its name.

find_node_name

Finds a node by its name.

find_sklearn_module

Finds the corresponding modulee for an element of scikit-learn.

find_suitable_problem

Defines suitables problems for additional converters.

find_suitable_problem

Determines problems suitable for a given scikit-learn operator. It may be

fit_classification_model

Fits a classification model.

fit_classification_model_simple

Fits a classification model.

fit_multilabel_classification_model

Fits a classification model.

fit_regression_model

Fits a regression model.

fix_missing_imports

The execution of a file through function exec does not import new modules. They must be there when it is …

floor

See numpy.floor().

from_array

Converts an array into an ONNX tensor.

from_bytes

Retrieves an array from bytes then protobuf.

from_pb

Extracts tensor description from a protobuf.

gather_numpy

Gathers values along an axis specified by dim. For a 3-D tensor the output is specified by:

gather_numpy_2

gemm_dot

Implements dot product with gemm when possible.

get_args_kwargs

Extracts arguments and optional parameters of a function.

get_column_index

Returns a tuples (variable index, column index in that variable). The function has two different behaviours, one when …

get_column_indices

Returns the requested graph inpudes based on their indices or names. See get_column_index().

get_cpp_template

Template to export ONNX into a C++ code.

get_default_context

Returns a default context useful for most of the conversion from a function using numpy into ONNX.

get_default_context_cpl

Returns a default useful context to compile the converter returned by translate_fct2onnx().

get_defined_inputs

Retrieves defined inputs in already declared variables bsed on their names.

get_defined_outputs

Gets types of predefined outputs when they cannot be inferred. Some part of it should be automated based on type …

get_domain_list

Returns the list of available domains.

get_dtype_shape

Returns the shape of a tensor.

get_hidden_inputs

Returns the list of hidden inputs used by subgraphs.

get_hidden_inputs

Returns the list of hidden inputs used by subgraphs.

get_im2col_indices

Source im2col.py.

get_inputs_from_data

Produces input data for onnx runtime.

get_ir_version

Returns the corresponding IR_VERSION based on the selected opset. See ONNX Version.

get_max_value

Returns the maximum value for a specific type.

get_numpy_template

Template to export ONNX into numpy code.

get_onnx_example

Retrieves examples associated to one operator stored in onnx packages.

get_onnx_schema

Returns the operator schema for a specific operator.

get_onnx_template

Template to export ONNX into onnx code.

get_operator_schemas

Returns all schemas mapped to an operator name.

get_opsets

Enumerates all opsets used in a model.

get_ort_device

Converts device into C_OrtDevice.

get_python_template

Template to export ONNX into a python code.

get_rst_doc

Returns a documentation in RST format for all OnnxOperator.

get_rst_doc

Returns a documentation in RST format for all OnnxOperator.

get_sklearn_json_params

Retrieves all the parameters of a scikit-learn model.

get_tensor_elem_type

Returns the element type if that makes sense for this object.

get_tensor_elem_type

Returns the element type if that makes sense for this object.

get_tensor_shape

Returns the shape if that makes sense for this object.

get_tensor_shape

Returns the shape if that makes sense for this object.

get_tf2onnx_template

Template to export ONNX into tensorflow-onnx code.

get_xop_template

Template to export ONNX into a code based on XOP API.

graph_predecessors_and_successors

Returns the successors and the predecessors within on ONNX graph.

guess_dtype

Converts a proto type into a numpy type.

guess_initial_types

Guesses initial types from an array or a dataframe.

guess_numpy_type

Guesses the corresponding numpy type based on data_type.

guess_numpy_type_from_dtype

Converts a string (such as ‘dtype(float32)’) into a numpy dtype.

guess_numpy_type_from_string

Converts a string (such as ‘float’) into a numpy dtype.

guess_proto_dtype

Guesses the ONNX dtype given a numpy dtype.

guess_proto_dtype_name

Returns a string equivalent to onnx_dtype.

guess_schema_from_data

Guesses initial types from a dataset.

guess_schema_from_model

Guesses initial types from a model.

hash_onnx_object

Hashes the content of an object. It uses module hashlib.

heatmap

Creates a heatmap from a numpy array and two lists of labels. See plot_benchmark_metrics() for an example.

hstack

See numpy.hstack().

identify_interpreter

Identifies the interpreter for a scikit-learn model.

identity

Identity.

im2col

Returns the result of im2col on a image NHCW where N is 1. The function is equivalent to torch.nn.Unfold()

im2col_indices

Source im2col.py.

im2col_infer_output_shape

Computes the ouput shape of im2col.

im2col_naive_implementation

Naive implementation for im2col or torch.nn.Unfold() (but with padding=1).

im2col_nchw

C implementation of a partial im2col.

im2col_nn

Functions nn_im2col_2d() and im2col() returns the same results but with different shapes. This function …

im2col_recursive

Recursive implementation, falls back to im2col_naive_implementation() for dimension <= fall_back_dim. The …

insert_node

Inserts a node before one node input.

insert_results_into_onnx

Inserts results into an ONNX graph to produce an extended ONNX graph. It can be saved and looked into with a tool such …

inspect_sklearn_model

Inspects a scikit-learn model and produces some figures which tries to represent the complexity of it.

interpret_options_from_string

Converts a string into a dictionary.

iris_data

Returns (X, y) for iris data.

is_backend_enabled

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

is_last_schema

Tells if this is the most recent schema for this operator.

is_numpy_dtype

Tells if a dtype is a numpy dtype.

is_transpose_identity

Tells if the permutation perm does nothing (itentity).

isnan

See numpy.isnan().

latency

Measures the latency of a model (python API).

latency

Measures the latency of a model (python API).

lightgbm_parser

Agnostic parser for LightGBM Booster.

linear_regression

Returns a linear regression converted into ONNX.

load_audit

Use to test conversion of sklearn.ensemble.GradientBoostingClassifier into ONNX.

load_data

Restores protobuf data stored in a folder.

load_data_and_model

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

load_ipython_extension

To allow the call %load_ext mlprodict

load_op

Sets up a class for a specific ONNX operator.

load_op

Gets the operator related to the onnx node.

load_op

Gets the operator related to the onnx node. This runtime does nothing and never complains.

load_op

Gets the operator related to the onnx node.

loadop

Dynamically creates a class for a every operator type in the given list.

log

See numpy.log().

log1p

See numpy.log1p().

logistic_regression

Returns a logistic regression converted into ONNX, option zipmap is set to false.

main

Implements python -m mlprodict <command> <args>.

make_callable

Creates a callable function able to cope with default values as the combination of functions compile and exec

make_hash_bytes

Creates a hash of length length.

make_n_rows

Multiplies or reduces the rows of x to get exactly n rows.

make_name

Creates a unique name.

make_numpy_code

Converts an ONNX operators into numpy code.

make_readable_title

Creates a readable title based on the test information.

make_slice

Implements operator slice in numpy.

make_sure

Raises an exception if cond is not verified.

make_tf2onnx_code

Converts an ONNX operators into tf2onnx code.

make_value_info

Converts a variable defined by its name, type and shape into onnx.ValueInfoProto.

map_onnx_to_numpy_type

Converts ONNX type into numpy type.

matmul

See numpy.matmul().

max_depth

Retrieves the max depth assuming the estimator is a decision tree.

max_supported_opset

Returns the latest supported opset for the main domain.

mean

See numpy.mean().

measure_relative_difference

Measures the relative difference between predictions between two ways of computing them. The functions returns nan …

measure_time

Measures a statement and returns the results as a dictionary.

merge_benchmark

Merges several benchmarks run with command line validate_runtime.

merge_results

Merges results by name. The first ones are used to keep the order.

modify_tree_for_rule_in_set

LightGBM produces sometimes a tree with a node set to use rule == to a set of values (= in set), the values …

modules_list

Returns modules and versions currently used.

new_array

Creates a new empty array.

new_calculate_sklearn_function_transformer_output_shapes

Rewrites the converters implemented in sklearn-onnx to support custom functions implemented with Complete Numpy API for ONNX. …

new_convert_sklearn_decision_tree_classifier

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

new_convert_sklearn_decision_tree_regressor

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

new_convert_sklearn_function_transformer

Rewrites the converters implemented in sklearn-onnx to support custom functions implemented with Complete Numpy API for ONNX. …

new_convert_sklearn_gradient_boosting_classifier

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

new_convert_sklearn_gradient_boosting_regressor

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

new_convert_sklearn_random_forest_classifier

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

new_convert_sklearn_random_forest_regressor

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

new_convert_sklearn_svm_classifier

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

new_convert_sklearn_svm_regressor

Rewrites the converters implemented in sklearn-onnx to support an operator supporting doubles.

nn_col2im_2d

C++ implementation for col2im or torch.nn.Fold().

nn_im2col_2d

C++ implementation for im2col or torch.nn.Unfold().

numpy_diagonal

Extracts diagonal coefficients from an array.

numpy_dot_inplace

Implements a dot product, deals with inplace information. See numpy.dot.

numpy_extended_dot

Extended version of a matrix multiplication (numpy.dot) with two matrices m1, m2 of the same dimensions. …

numpy_extended_dot_matrix

Implementation of numpy_extended_dot() using dot product, multiplication, transpose and reduction but not …

numpy_extended_dot_ouput_shape

Computes the output shape of results produced by function numpy_extended_dot

numpy_extended_dot_python

Implementation of numpy_extended_dot() in pure python. This implementation is not efficient but shows how to …

numpy_matmul_inplace

Implements a matmul product, deals with inplace information. See numpy.matmul. Inplace computation does …

numpy_max

Returns the maximum of an array. Deals with text as well.

numpy_max

Returns the maximum of an array. Deals with text as well.

numpy_min

Returns the minimum of an array. Deals with text as well.

numpy_min

Returns the maximum of an array. Deals with text as well.

numpy_min_max

Returns the minimum of an array. Deals with text as well.

numpy_type_prototype

Converts a numpy dtyp into a TensorProto dtype.

numpy_type_prototype

Converts a numpy dtyp into a TensorProto dtype.

onnx2bigraph

Converts an ONNX graph into a graph representation, edges, vertices.

onnx_code

Exports an ONNX graph into a python code creating the same graph.

onnx_documentation_folder

Creates documentation in a folder for all known ONNX operators or a subset.

onnx_function_to_model

Converts an ONNX FunctionProto into a ModelProto. The function does not handle attributes yet.

onnx_graph_distance

Computes a distance between two ONNX graphs. They must not be too big otherwise this function might take for ever. …

onnx_if

Implements a test with onnx syntax.

onnx_inline_function

Inlines functions in an ONNX graph.

onnx_model_opsets

Extracts opsets in a dictionary.

onnx_model_to_function

Converts an ONNX model into a function. The returned function has no attribute.

onnx_optim

Optimizes an ONNX model.

onnx_optimisations

Calls several possible optimisations including onnx_remove_node().

onnx_pad

Implements numpy.pad based on ONNX signature.

onnx_remove_node

Removes as many nodes as possible without changing the outcome. It applies onnx_remove_node_unused(), onnx_remove_node_identity(), …

onnx_remove_node_identity

Removes as many Identity nodes as possible. The function looks into every node and subgraphs if recursive is …

onnx_remove_node_redundant

Removes redundant part of the graph. A redundant part is a set of nodes which takes the same inputs and produces …

onnx_remove_node_unused

Removes unused nodes of the graph. An unused node is not involved in the output computation.

onnx_rename_inputs_outputs

Renames input or outputs names.

onnx_rename_names

Renames all names except the inputs and outputs.

onnx_replace_functions

Replaces some of the function in model.

onnx_shaker

Shakes a model ONNX. Explores the ranges for every prediction. Uses astype_range()

onnx_simple_text_plot

Displays an ONNX graph into text.

onnx_statistics

Computes statistics on ONNX models, extracts informations about the model such as the number of nodes.

onnx_stats

Computes statistics on an ONNX model.

onnx_subgraphs_level

Returns the depth of the graph.

onnx_text_plot

Uses onnx2bigraph() to convert the ONNX graph into text.

onnx_text_plot_io

Displays information about input and output types.

onnx_text_plot_tree

Gives a textual representation of a tree ensemble.

onnxnumpy

Decorator to declare a function implemented using numpy syntax but executed with ONNX operators. …

onnxnumpy_default

Decorator with options to declare a function implemented using numpy syntax but executed with ONNX

onnxnumpy_np

Decorator to declare a function implemented using numpy syntax but executed with ONNX operators. …

onnxsklearn_class

Decorator to declare a converter for a class derivated from scikit-learn, implementing inference method …

onnxsklearn_classifier

Decorator to declare a converter for a classifier implemented using numpy syntax but executed with ONNX

onnxsklearn_cluster

Decorator to declare a converter for a cluster implemented using numpy syntax but executed with ONNX

onnxsklearn_regressor

Decorator to declare a converter for a regressor implemented using numpy syntax but executed with ONNX

onnxsklearn_transformer

Decorator to declare a converter for a transformer implemented using numpy syntax but executed with ONNX

onnxview

Displays an ONNX graph into a notebook.

optimize_decompose_einsum_equation

Proposes a new implementation of numpy.einsum. It does not allow expresion using and expects a right …

ort_version_greater

Tells if onnxruntime version is greater than ver.

overwrite_opset

Overwrites the main opset in an ONNX file. Does not change any node definition.

pad

It does not implement numpy.pad() but the ONNX version onnx_pad. …

pairwise_array_distances

Computes pairwise distances between two lists of arrays l1 and l2. The distance is 1e9 if shapes are not equal.

parser_transfer_transformer

Parser for TransferTransformer.

plot_benchmark_metrics

Plots a heatmap which represents a benchmark. See example below.

plot_onnx

Plots an ONNX graph on the standard output.

plot_onnx

Plots an ONNX graph into a matplotlib graph.

plot_validate_benchmark

Plots a graph which summarizes the performances of a benchmark validating a runtime for ONNX.

predict_transposition_cost

Given a shape and a permutation, predicts the cost of the transposition.

prepare_c_profiling

Prepares model and data to be profiled with tool perftest

print_code

Returns the code with line number.

prod

See numpy.prod().

proto2dtype

Converts a proto type into a numpy type.

proto2vars

Converts proto values to Variables.

py_make_float_array

Creates an array with a single element from a constant.

py_mul

Function for python operator *.

py_opp

Function for python unary operator -.

py_pow

Function for python operator **.

pycelu

Computes function celu(x).

pygemm

Pure python implementatin of GEMM.

random_feed

Creates a dictionary of random inputs.

reciprocal

See numpy.reciprocal().

register_converters

This functions registers additional converters to the list of converters sklearn-onnx declares.

register_new_operators

Registers new operator relying on pieces implemented in this package such as the numpy API for ONNX.

register_onnx_magics

Register magics function, can be called from a notebook.

register_operator

Registers a new runtime operator.

register_rewritten_operators

Registers modified operators and returns the old values.

register_scorers

Registers operators for @see cl CustomScorerTransform.

regressor

Returns any regressor from scikit-learn converted into ONNX assuming a converter is registered with sklearn-onnx. …

relu

relu

reorder_nodes_for_display

Reorders the node with breadth first seach (BFS).

reshape_reference_implementation

restore_lgbm_info

Restores speed up information to help modifying the structure of the tree.

round

See numpy.round().

scatter_elements

score_cdist_sum

Computes the sum of pairwise distances between expected_values and predictions. It has no particular purpose …

select_attribute

Returns the list of the same attribute. [el.att for el in ens].

select_model_inputs_outputs

Takes a model and changes its outputs.

set_n_jobs

Looks into model signature and add parameter n_jobs if available. The function does not overwrite the parameter.

set_random_state

Sets all possible parameter random_state to 0.

setup

Sphinx extension mlprodict.npy.xop_sphinx displays documentation on ONN Operators.

sgemm_dot

sgemm_dot(float[:,

shape_abs

Infers shape for operator Abs.

shape_acos

Infers shape for operator Acos.

shape_acosh

Infers shape for operator Acosh.

shape_add

Infers shape for operator Add.

shape_and

Infers shape for operator And.

shape_asin

Infers shape for operator Asin.

shape_asinh

Infers shape for operator Asinh.

shape_atan

Infers shape for operator Atan.

shape_atanh

Infers shape for operator Atanh.

shape_calculator_lightgbm_concat

Shape calculator for operator LightGBMConcat.

shape_calculator_transfer_transformer

Shape calculator for TransferTransformer.

shape_castlike

Infers shape for operator CastLike.

shape_ceil

Infers shape for operator Ceil.

shape_celu

Infers shape for operator Celu.

shape_clip

Infers shape for operator Clip.

shape_cos

Infers shape for operator Cos.

shape_cosh

Infers shape for operator Cosh.

shape_det

Infers shape for operator Abs.

shape_dispatch

Calls the corresponding fucntion for every node.

shape_div

Infers shape for operator Div.

shape_elu

Infers shape for operator Elu.

shape_equal

Infers shape for operator Equal.

shape_erf

Infers shape for operator Erf.

shape_exp

Infers shape for operator Exp.

shape_floor

Infers shape for operator Floor.

shape_greater

Infers shape for operator Greater.

shape_greaterorequal

Infers shape for operator GreaterOrEqual.

shape_hardmax

Infers shape for operator Hardmax.

shape_hardsigmoid

Infers shape for operator HardSigmoid.

shape_identity

Infers shape for operator Identity.

shape_isinf

Infers shape for operator IsInf.

shape_isnan

Infers shape for operator IsNan.

shape_leakyrelu

Infers shape for operator LeakyRelu.

shape_less

Infers shape for operator Less.

shape_lessorequal

Infers shape for operator LessOrEqual.

shape_log

Infers shape for operator Log.

shape_logsoftmax

Infers shape for operator LogSoftmax.

shape_max

Infers shape for operator Max.

shape_min

Infers shape for operator Min.

shape_mod

Infers shape for operator Mod.

shape_mul

Infers shape for operator Mul.

shape_neg

Infers shape for operator Neg.

shape_not

Infers shape for operator Not.

shape_or

Infers shape for operator Or.

shape_pow

Infers shape for operator Pow.

shape_reciprocal

Infers shape for operator Reciprocal.

shape_relu

Infers shape for operator Relu.

shape_round

Infers shape for operator Round.

shape_selu

Infers shape for operator Selu.

shape_shrink

Infers shape for operator Shrink.

shape_sigmoid

Infers shape for operator Sigmoid.

shape_sign

Infers shape for operator Sigmoid.

shape_sin

Infers shape for operator Sin.

shape_sinh

Infers shape for operator Sinh.

shape_softmax

Infers shape for operator Softmax.

shape_softplus

Infers shape for operator Softplus.

shape_softsign

Infers shape for operator Softsign.

shape_sqrt

Infers shape for operator Sqrt.

shape_sub

Infers shape for operator Sub.

shape_tan

Infers shape for operator Tan.

shape_tanh

Infers shape for operator Tanh.

shape_thresholdedrelu

Infers shape for operator ThresholdedRelu.

shape_trilu

Infers shape for operator Trilu.

shape_xor

Infers shape for operator Xor.

short_list_zoo_models

Returns a short list from ONNX Zoo.

shorten_onnx_options

Shortens onnx options into a string. Long names hide some part of graphs in asv benchmark.

side_by_side_by_values

Compares the execution of two sessions. It calls method OnnxInference.run

sigmoid

See scipy.special.expit.

sign

See numpy.sign().

sin

See numpy.sin().

single_axes

axes contains positive values, then it is the position of this axis in the original matrix, otherwise it is -1 …

sinh

See numpy.sinh().

sizeof_dtype

sklearn2graph

Converts any kind of scikit-learn model into a grammar model.

sklearn_decision_tree_regressor

Converts a DecisionTreeRegressor

sklearn_linear_regression

Converts a linear regression

sklearn_logistic_regression

Interprets a logistic regression

sklearn_operators

Builds the list of operators from scikit-learn. The function goes through the list of submodule and get …

sklearn_standard_scaler

Converts a standard scaler

softmaxcrossentropy

Modified version of softmaxcrossentropy.py

split_columns_subsets

Functions used in the documentation to split a dataframe by columns into multiple dataframe to reduce the scrolling. …

sqrt

See numpy.sqrt().

squareform_pdist

Replacements for squareform

squeeze

See numpy.squeeze().

sum

See numpy.sum().

summary_report

Finalizes the results computed by function enumerate_validated_operator_opsets().

tan

See numpy.tan().

tanh

See numpy.tanh().

test_qlinear_conv

Checks a runtime for operator QLinearConv.

timeexec

Measures the time for a given expression.

timeit_repeat

Returns a series of repeat time measures for number executions of code assuming fct is a function.

to_bytes

Converts an array into protobuf and then into bytes.

to_onnx

Converts a model using on sklearn-onnx.

to_onnx_function

Converts a model using on sklearn-onnx. The functions works as the same as function to_onnx() but …

to_skl2onnx_type

Converts name, elem_type, shape into a sklearn-onnx type.

topk

See numpy.argsort().

topk_sorted_implementation

Retrieves the top-k elements.

topk_sorted_implementation_cpp

Retrieves the top-k elements using a C++ implementation when the axis is the last dimension, otherwise, it falls …

transformer

Returns any transformer from scikit-learn converted into ONNX assuming a converter is registered with sklearn-onnx. …

transformer_target_regressor_converter

Rewrites the converters implemented in sklearn-onnx to support custom functions implemented with Complete Numpy API for ONNX. …

transformer_target_regressor_shape_calculator

Rewrites the converters implemented in sklearn-onnx to support custom functions implemented with Complete Numpy API for ONNX. …

translate_fct2onnx

Translates a function into ONNX. The code it produces is using classes OnnxAbs, OnnxAdd, …

transpose

See numpy.transpose().

type_mapping

Mapping between types name and type integer value.

unsqueeze

See numpy.expand_dims().

update_registered_converter_npy

Registers or updates a converter for a new model so that it can be converted when inserted in a scikit-learn pipeline. …

validate_python_inference

Validates the code produced by method to_python. …

validate_runtime

Walks through most of scikit-learn operators or model or predictor or transformer, tries to convert them …

verify_code

Verifies python code.

verify_model

Verifies a model.

verify_script

Checks that models fitted in an example from scikit-learn documentation can be converted into ONNX.

version2number

Converts a version number into a real number.

visual_rst_template

Returns a jinja2 template to display DOT graph for each converter from sklearn-onnx.

vstack

See numpy.vstack().

where

See numpy.where().