sdkagent

onnx API reference

88 public APIs from onnx (onnx/onnx) — 14 classes, 61 functions, 13 methods. Signatures extracted by static analysis of the actual source.

Repository: onnx/onnx

KindCount
Classes14
Functions61
Methods13

API list

methodonnx.backend.base.Backend.supports_device(device:str) -> bool
Checks whether the backend is compiled with particular device support.
classonnx.backend.base.DeviceType
Describes device type.
funconnx.checker.check_model(model:onnx.ModelProto | str | bytes | os.PathLike, full_check:bool=False, skip_opset_compatibility_check:bool=False, check_custom_domain:bool=False) -> None
Check the consistency of a model.
funconnx.defs.get_function_ops() -> list[OpSchema]
Return operators defined as functions.
funconnx.defs.onnx_ml_opset_version() -> int
Return current opset for domain `ai.onnx.ml`.
funconnx.defs.onnx_opset_version() -> int
Return current opset for domain `ai.onnx`.
funconnx.defs.register_schema(schema:OpSchema) -> None
Register a user provided OpSchema.
funconnx.external_data_helper.load_external_data_for_tensor(tensor:TensorProto, base_dir:str) -> None
Loads data from an external file for tensor.
funconnx.external_data_helper.uses_external_data(tensor:TensorProto) -> bool
Returns true if the tensor stores data in an external location.
funconnx.helper.get_all_tensor_dtypes() -> KeysView[int]
Get all tensor types from TensorProto.
funconnx.helper.make_attribute(key:str, value:Any, doc_string:str | None=None, attr_type:int | None=None) -> AttributeProto
Makes an AttributeProto based on the value type.
funconnx.helper.make_map(name:str, key_type:int, keys:list[Any], values:SequenceProto) -> MapProto
Make a Map with specified key-value pair arguments.
funconnx.helper.make_map_type_proto(key_type:int, value_type:TypeProto) -> TypeProto
Makes a map TypeProto.
funconnx.helper.make_node(op_type:str, inputs:Sequence[str], outputs:Sequence[str], name:str | None=None, doc_string:str | None=None, domain:str | None=None, overload:str | None=None, **kwargs:Any) -> NodeProto
Construct a NodeProto.
funconnx.helper.make_operatorsetid(domain:str, version:int) -> OperatorSetIdProto
Construct an OperatorSetIdProto.
funconnx.helper.make_opsetid(domain:str, version:int) -> OperatorSetIdProto
Construct an OperatorSetIdProto.
funconnx.helper.make_optional(name:str, elem_type:OptionalProto.DataType, value:google.protobuf.message.Message | None) -> OptionalProto
Make an Optional with specified value arguments.
funconnx.helper.make_optional_type_proto(inner_type_proto:TypeProto) -> TypeProto
Makes an optional TypeProto.
funconnx.helper.make_sequence(name:str, elem_type:SequenceProto.DataType, values:Sequence[Any]) -> SequenceProto
Make a Sequence with specified value arguments.
funconnx.helper.make_sequence_type_proto(inner_type_proto:TypeProto) -> TypeProto
Makes a sequence TypeProto.
funconnx.helper.make_tensor(name:str, data_type:int, dims:Sequence[int], vals:Sequence[int | float] | bytes | np.ndarray, raw:bool=False) -> TensorProto
Make a TensorProto with specified arguments.
funconnx.helper.make_value_info(name:str, type_proto:TypeProto, doc_string:str='') -> ValueInfoProto
Makes a ValueInfoProto with the given type_proto.
funconnx.helper.np_dtype_to_tensor_dtype(np_dtype:np.dtype) -> TensorProto.DataType
Convert a numpy's dtype to corresponding tensor type.
funconnx.helper.printable_graph(graph:GraphProto, prefix:str='') -> str
Display a GraphProto as a string.
funconnx.helper.strip_doc_string(proto:google.protobuf.message.Message) -> None
Empties `doc_string` field on any nested protobuf messages
funconnx.helper.tensor_dtype_to_field(tensor_dtype:int) -> str
Convert a TensorProto's data_type to corresponding field name for storage.
funconnx.helper.tensor_dtype_to_np_dtype(tensor_dtype:int) -> np.dtype
Convert a TensorProto's data_type to corresponding numpy dtype.
funconnx.helper.tensor_dtype_to_string(tensor_dtype:int) -> str
Get the name of given TensorProto's data_type.
funconnx.inliner.inline_local_functions(model:onnx.ModelProto, convert_version:bool=False) -> onnx.ModelProto
Inline model-local functions in given model.
funconnx.inliner.inline_selected_functions(model:onnx.ModelProto, function_ids:list[tuple[str, str]], exclude:bool=False, inline_schema_functions:bool=False) -> onnx.ModelProto
Inline selected functions in given model.
funconnx.load_model(f:IO[bytes] | str | os.PathLike, format:_SupportedFormat | None=None, load_external_data:bool=True) -> ModelProto
Loads a serialized ModelProto into memory.
funconnx.load_tensor(f:IO[bytes] | str | os.PathLike, format:_SupportedFormat | None=None) -> TensorProto
Loads a serialized TensorProto into memory.
funconnx.model_container.make_large_tensor_proto(location:str, tensor_name:str, tensor_type:int, shape:tuple[int, ...]) -> onnx.TensorProto
Create an external tensor.
funconnx.numpy_helper.create_random_int(input_shape:tuple[int], dtype:np.dtype, seed:int=1) -> np.ndarray
Create random integer array for backend/test/case/node.
funconnx.numpy_helper.from_dict(dict_:dict[Any, Any], name:str | None=None) -> onnx.MapProto
Converts a Python dictionary into a map def.
funconnx.numpy_helper.from_list(lst:list[Any], name:str | None=None, dtype:int | None=None) -> onnx.SequenceProto
Converts a list into a sequence def.
funconnx.numpy_helper.from_optional(opt:Any | None, name:str | None=None, dtype:int | None=None) -> onnx.OptionalProto
Converts an optional value into a Optional def.
funconnx.numpy_helper.saturate_cast(x:np.ndarray, dtype:np.dtype) -> np.ndarray
Saturate cast for numeric types.
funconnx.numpy_helper.to_array(tensor:onnx.TensorProto, base_dir:str='') -> np.ndarray
Converts a tensor def object to a numpy array.
funconnx.numpy_helper.to_dict(map_proto:onnx.MapProto) -> dict[Any, Any]
Converts a map def to a Python dictionary.
funconnx.numpy_helper.to_float8e8m0(x:np.ndarray, saturate:bool=True, round_mode:str='up') -> np.ndarray
Convert float32 NumPy array to float8e8m0 representation.
funconnx.numpy_helper.to_list(sequence:onnx.SequenceProto) -> list[Any]
Converts a sequence def to a Python list.
funconnx.numpy_helper.to_optional(optional:onnx.OptionalProto) -> Any | None
Converts an optional def to a Python optional.
funconnx.numpy_helper.tobytes_little_endian(array:np.ndarray) -> bytes
Converts an array into bytes in little endian byte order.
funconnx.parser.parse_function(function_text:str) -> onnx.FunctionProto
Parse a string to build a FunctionProto.
funconnx.parser.parse_graph(graph_text:str) -> onnx.GraphProto
Parse a string to build a GraphProto.
funconnx.parser.parse_model(model_text:str) -> onnx.ModelProto
Parse a string to build a ModelProto.
funconnx.parser.parse_node(node_text:str) -> onnx.NodeProto
Parse a string to build a NodeProto.
classonnx.reference.op_run.OpFunction
Runs a custom function.
classonnx.reference.op_run.OpRun
Ancestor to all operators in this subfolder.
methodonnx.reference.op_run.OpRun.create(n_inputs:int | None=None, n_outputs:int | None=None, verbose:int=0, **kwargs:Any) -> Any
Instantiates this class based on the given information.
methodonnx.reference.op_run.OpRun.domain() -> str
Returns node attribute `domain`.
methodonnx.reference.op_run.OpRun.eval(*n_outputs:int | None=None, *verbose:int=0, *args:list[Any], **kwargs:Any) -> Any
Evaluates this operator.
methodonnx.reference.op_run.OpRun.input() -> Sequence[str]
Returns node attribute `input`.
methodonnx.reference.op_run.OpRun.op_type() -> str
Returns node attribute `op_type`.
methodonnx.reference.op_run.OpRun.output() -> Sequence[str]
Returns node attribute `output`.
classonnx.reference.op_run.OpRunExpand
Class any operator to avoid must inherit from.
classonnx.reference.op_run.RuntimeImplementationError
Raised when no implementation was found for an operator.
classonnx.reference.op_run.RuntimeTypeError
Raised when a type of a variable is unexpected.
classonnx.reference.op_run.SparseTensor
Simple representation of a sparse tensor.
funconnx.reference.op_run.to_sparse_tensor(att:onnx.AttributeProto) -> SparseTensor
Hosts a sparse tensor.
classonnx.reference.ops._op.OpRunBinary
Ancestor to all binary operators in this subfolder.
classonnx.reference.ops._op.OpRunBinaryNum
Ancestor to all binary operators in this subfolder.
classonnx.reference.ops._op.OpRunReduceNumpy
Implements the reduce logic.
classonnx.reference.ops._op.OpRunUnary
Ancestor to all unary operators in this subfolder.
methodonnx.reference.ops._op.OpRunUnaryNum.run(x)
Calls method ``OpRunUnary.run``.
funconnx.reference.ops.aionnx_preview._op_list.load_op(domain:str, op_type:str, version:int | None, custom:Any=None) -> Any
Loads the implemented for a specified operator.
funconnx.reference.ops.aionnx_preview_training._op_list.load_op(domain:str, op_type:str, version:int | None, custom:Any=None) -> Any
Loads the implemented for a specified operator.
funconnx.reference.ops.aionnxml._common_classifier.compute_softmax_zero(values:np.ndarray) -> np.ndarray
The function modifies the input inplace.
funconnx.reference.ops.aionnxml._common_classifier.softmax(values:np.ndarray) -> np.ndarray
Modifications in place.
funconnx.reference.ops.aionnxml._common_classifier.softmax_zero(values:np.ndarray) -> np.ndarray
Modifications in place.
funconnx.reference.ops.aionnxml._op_list.load_op(domain:str, op_type:str, version:int | None, custom:Any=None) -> Any
Loads the implemented for a specified operator.
methodonnx.reference.ops.aionnxml.op_normalizer.Normalizer.norm_l1(x)
L1 normalization
methodonnx.reference.ops.aionnxml.op_normalizer.Normalizer.norm_l2(x)
L2 normalization
methodonnx.reference.ops.aionnxml.op_normalizer.Normalizer.norm_max(x)
Max normalization
classonnx.reference.ops.aionnxml.op_svm_helper.SVMCommon
Base class for SVM.
classonnx.reference.ops.aionnxml.op_svm_regressor.SVMRegressor
The class only implements `POST_TRANSFORM="NONE"`.
methodonnx.reference.ops.aionnxml.op_tree_ensemble_helper.TreeEnsemble.leaf_index_tree(X:np.ndarray, tree_id:int) -> int
Computes the leaf index for one tree.
methodonnx.reference.ops.aionnxml.op_tree_ensemble_helper.TreeEnsemble.leave_index_tree(X:np.ndarray) -> np.ndarray
Computes the leaf index for all trees.
funconnx.reference.ops.experimental._op_list.load_op(domain:str, op_type:str, version:int | None, custom:Any=None) -> Any
Loads the implemented for a specified operator.
classonnx.reference.ops.op_blackman_window.BlackmanWindow
Blankman windowing function.
funconnx.reference.ops.op_matmul.numpy_matmul(a, b)
Implements a matmul product.
funconnx.reference.ops.op_scatter_elements.scatter_elements(data, indices, updates, axis=0, reduction=None)
Scatter elements.
funconnx.save_tensor(proto:TensorProto, f:IO[bytes] | str | os.PathLike, format:_SupportedFormat | None=None) -> None
Saves the TensorProto to the specified path.
funconnx.shape_inference.infer_shapes(model:ModelProto | bytes, check_type:bool=False, strict_mode:bool=False, data_prop:bool=False) -> ModelProto
Apply shape inference to the provided ModelProto.
funconnx.shape_inference.infer_shapes_path(model_path:str | os.PathLike, output_path:str | os.PathLike='', check_type:bool=False, strict_mode:bool=False, data_prop:bool=False) -> None
Take model path for shape_inference.
funconnx.utils.extract_model(input_path:str | os.PathLike, output_path:str | os.PathLike, input_names:list[str], output_names:list[str], check_model:bool=True, infer_shapes:bool=True) -> None
Extracts sub-model from an ONNX model.
funconnx.version_converter.convert_version(model:ModelProto, target_version:int) -> ModelProto
Convert opset version of the ModelProto.

About this data

These signatures were extracted from the public source of onnx/onnx using Python's ast module. Argument names, default values, type annotations and return types are taken verbatim from the code. Implementation bodies are never stored. See how it works for details.

Back to all 805 libraries