onnx.mapping#

This module defines the correspondance between onnx numerical types and numpy numerical types. This information can be accessed through attribute TENSOR_TYPE_MAP or through the functions defined in onnx.helper.

TensorDtypeMap#

class onnx.mapping.TensorDtypeMap(np_dtype, storage_dtype, name)#

TENSOR_TYPE_MAP#

import pprint
from onnx.mapping import TENSOR_TYPE_MAP

pprint.pprint(TENSOR_TYPE_MAP)
{1: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=1, name='TensorProto.FLOAT'),
 2: TensorDtypeMap(np_dtype=dtype('uint8'), storage_dtype=6, name='TensorProto.UINT8'),
 3: TensorDtypeMap(np_dtype=dtype('int8'), storage_dtype=6, name='TensorProto.INT8'),
 4: TensorDtypeMap(np_dtype=dtype('uint16'), storage_dtype=6, name='TensorProto.UINT16'),
 5: TensorDtypeMap(np_dtype=dtype('int16'), storage_dtype=6, name='TensorProto.INT16'),
 6: TensorDtypeMap(np_dtype=dtype('int32'), storage_dtype=6, name='TensorProto.INT32'),
 7: TensorDtypeMap(np_dtype=dtype('int64'), storage_dtype=7, name='TensorProto.INT64'),
 8: TensorDtypeMap(np_dtype=dtype('O'), storage_dtype=8, name='TensorProto.STRING'),
 9: TensorDtypeMap(np_dtype=dtype('bool'), storage_dtype=6, name='TensorProto.BOOL'),
 10: TensorDtypeMap(np_dtype=dtype('float16'), storage_dtype=4, name='TensorProto.FLOAT16'),
 11: TensorDtypeMap(np_dtype=dtype('float64'), storage_dtype=11, name='TensorProto.DOUBLE'),
 12: TensorDtypeMap(np_dtype=dtype('uint32'), storage_dtype=12, name='TensorProto.UINT32'),
 13: TensorDtypeMap(np_dtype=dtype('uint64'), storage_dtype=13, name='TensorProto.UINT64'),
 14: TensorDtypeMap(np_dtype=dtype('complex64'), storage_dtype=1, name='TensorProto.COMPLEX64'),
 15: TensorDtypeMap(np_dtype=dtype('complex128'), storage_dtype=11, name='TensorProto.COMPLEX128'),
 16: TensorDtypeMap(np_dtype=dtype('float32'), storage_dtype=4, name='TensorProto.BFLOAT16')}

Opset Version#

onnx.defs.onnx_opset_version() int[source]#

Return current opset for domain ai.onnx.

onnx.defs.get_all_schemas_with_history() List[onnx.onnx_cpp2py_export.defs.OpSchema]#

Return the schema of all existing operators and all versions.

Operators and Functions Schemas#

onnx.defs.get_function_ops() List[OpSchema][source]#

Return operators defined as functions.

onnx.defs.get_schema(*args, **kwargs)#

Overloaded function.

  1. get_schema(op_type: str, max_inclusive_version: int, domain: str = ‘’) -> onnx.onnx_cpp2py_export.defs.OpSchema

Return the schema of the operator op_type and for a specific version.

  1. get_schema(op_type: str, domain: str = ‘’) -> onnx.onnx_cpp2py_export.defs.OpSchema

Return the schema of the operator op_type and for a specific version.

Internal module#

Schema submodule

class onnx.onnx_cpp2py_export.defs.OpSchema#

Schema of an operator.

class AttrType#

Members:

FLOAT

INT

STRING

TENSOR

GRAPH

FLOATS

INTS

STRINGS

TENSORS

GRAPHS

SPARSE_TENSOR

SPARSE_TENSORS

TYPE_PROTO

TYPE_PROTOS

property name#
class DifferentiationCategory#

Members:

Unknown

Differentiable

NonDifferentiable

property name#
class FormalParameterOption#

Members:

Single

Optional

Variadic

property name#
class SupportType#

Members:

COMMON

EXPERIMENTAL

property name#
get_context_dependent_function(self: onnx.onnx_cpp2py_export.defs.OpSchema, arg0: bytes, arg1: List[bytes]) bytes#
static is_infinite(arg0: int) bool#
exception onnx.onnx_cpp2py_export.defs.SchemaError#
onnx.onnx_cpp2py_export.defs.get_all_schemas() List[onnx.onnx_cpp2py_export.defs.OpSchema]#

Return the schema of all existing operators for the latest version.

onnx.onnx_cpp2py_export.defs.get_all_schemas_with_history() List[onnx.onnx_cpp2py_export.defs.OpSchema]#

Return the schema of all existing operators and all versions.

onnx.onnx_cpp2py_export.defs.get_schema(*args, **kwargs)#

Overloaded function.

  1. get_schema(op_type: str, max_inclusive_version: int, domain: str = ‘’) -> onnx.onnx_cpp2py_export.defs.OpSchema

Return the schema of the operator op_type and for a specific version.

  1. get_schema(op_type: str, domain: str = ‘’) -> onnx.onnx_cpp2py_export.defs.OpSchema

Return the schema of the operator op_type and for a specific version.

onnx.onnx_cpp2py_export.defs.has_schema(op_type: str, domain: str = '') bool#
onnx.onnx_cpp2py_export.defs.schema_version_map() Dict[str, Tuple[int, int]]#