.. _f-onnx2pyhelper: module ``onnx_tools.onnx2py_helper`` ==================================== Short summary +++++++++++++ module ``mlprodict.onnx_tools.onnx2py_helper`` Functions which converts :epkg:`ONNX` object into readable :epkg:`python` objects. :githublink:`%|py|6` Functions +++++++++ +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | function | truncated documentation | +=========================================================================================================+=======================================================================================================================+ | :func:`_elem_type_as_str ` | | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`_get_onnx_function ` | Returns the list of functions defined in ONNX package. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`_numpy_array ` | Single function to create an array. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`_sparse_array ` | Single function to create an sparse array (:epkg:`coo_matrix`). | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`_to_array ` | | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`_type_to_string ` | Converts a type into a readable string. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`_var_as_dict ` | Converts a protobuf object into something readable. The current implementation relies on :epkg:`json`. That's not ... | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`copy_value_info ` | Makes a copy of `onnx.ValueInfoProto`. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`from_array ` | Converts an array into an ONNX tensor. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`from_bytes ` | Retrieves an array from bytes then protobuf. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`from_pb ` | Extracts tensor description from a protobuf. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`get_dtype_shape ` | Returns the shape of a tensor. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`get_onnx_schema ` | Returns the operator schema for a specific operator. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`get_tensor_elem_type ` | Returns the element type if that makes sense for this object. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`get_tensor_shape ` | Returns the shape if that makes sense for this object. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`guess_dtype ` | Converts a proto type into a :epkg:`numpy` type. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`guess_numpy_type_from_dtype ` | Converts a string (such as `'dtype(float32)'`) into a numpy dtype. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`guess_numpy_type_from_string ` | Converts a string (such as `'float'`) into a numpy dtype. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`guess_proto_dtype ` | Guesses the ONNX dtype given a numpy dtype. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`guess_proto_dtype_name ` | Returns a string equivalent to `onnx_dtype`. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`make_value_info ` | Converts a variable defined by its name, type and shape into `onnx.ValueInfoProto`. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`numpy_max ` | Returns the maximum of an array. Deals with text as well. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`numpy_min ` | Returns the minimum of an array. Deals with text as well. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`numpy_type_prototype ` | Converts a numpy dtyp into a TensorProto dtype. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`onnx_model_opsets ` | Extracts opsets in a dictionary. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`to_bytes ` | Converts an array into protobuf and then into bytes. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ | :func:`to_skl2onnx_type ` | Converts *name*, *elem_type*, *shape* into a :epkg:`sklearn-onnx` type. | +---------------------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------+ Documentation +++++++++++++ .. automodule:: mlprodict.onnx_tools.onnx2py_helper :members: :special-members: __init__ :show-inheritance: