onnx_light.onnx_op#

The onnx_light.onnx_op module exposes the lightweight operator schemas (LightOpSchema) shipped with onnx_light. These are the schemas used by the automated operator documentation pages under ONNX Operators and by the rest of onnx_light whenever operator metadata is needed without depending on the upstream onnx_light.onnx.defs (OpSchema) registry.

Python re-export of the onnx_op C++ extension (LightOpSchema).

This module exposes the lightweight operator-schema types defined in the C++ onnx_op library through a stable Python import path (onnx_light.onnx_op). The underlying objects are implemented in C++ (onnx_light/onnx_op/light_op_schema.{h,cc} and the operator-set registries under onnx_light/onnx_op/operator_sets_*.{h,cc}) and bound to Python via onnx_light.onnx_py._onnxpy_op.

The LightOpSchema class is the onnx_light analogue of onnx_light.onnx.defs.OpSchema: a read-only description of a single versioned ONNX operator that documentation and validation tools can consume without depending on the full upstream onnx package.

class onnx_light.onnx_op.AttributeParam(*args, **kwargs)#

A single operator attribute as exposed by LightOpSchema.

property default_value#

Typed default value (None if absent, otherwise int, float, str, or a list thereof).

property default_value_repr#

Stable textual representation of default_value (empty when absent).

property description#

(self) -> str

property name#

(self) -> str

property required#

(self) -> bool

property type#

(self) -> onnx_light.onnx_py._onnxpy.onnx_op.AttributeType

class onnx_light.onnx_op.AttributeType(*values)#

ONNX attribute type; mirrors onnx::AttributeProto::AttributeType.

FLOAT = 1#
FLOATS = 6#
GRAPH = 5#
GRAPHS = 10#
INT = 2#
INTS = 7#
SPARSE_TENSOR = 11#
SPARSE_TENSORS = 12#
STRING = 3#
STRINGS = 8#
TENSOR = 4#
TENSORS = 9#
TYPE_PROTO = 13#
TYPE_PROTOS = 14#
UNDEFINED = 0#
class onnx_light.onnx_op.FormalParameter(*args, **kwargs)#

A single formal input or output parameter of an ONNX operator.

property description#

(self) -> str

property name#

(self) -> str

property type#

(self) -> str

class onnx_light.onnx_op.LightOpSchema(*args, **kwargs)#

Lightweight read-only description of an ONNX operator schema at one specific opset version.

property attributes#

(self) -> list[onnx_light.onnx_py._onnxpy.onnx_op.AttributeParam]

property doc#

(self) -> str

property domain#

(self) -> str

property has_function_implementation#

(self) -> bool

property inputs#

(self) -> list[onnx_light.onnx_py._onnxpy.onnx_op.FormalParameter]

property name#

(self) -> str

property outputs#

(self) -> list[onnx_light.onnx_py._onnxpy.onnx_op.FormalParameter]

property since_version#

(self) -> int

property type_constraints#

(self) -> list[onnx_light.onnx_py._onnxpy.onnx_op.TypeConstraintParam]

class onnx_light.onnx_op.TensorType(*values)#

Element or sequence tensor type supported by onnx-light.

kBfloat16 = 13#
kBool = 0#
kComplex128 = 25#
kComplex64 = 24#
kDouble = 12#
kFloat = 11#
kFloat16 = 10#
kFloat4e2m1 = 19#
kFloat8e4m3fn = 14#
kFloat8e4m3fnuz = 15#
kFloat8e5m2 = 16#
kFloat8e5m2fnuz = 17#
kFloat8e8m0 = 18#
kInt16 = 7#
kInt2 = 23#
kInt32 = 8#
kInt4 = 21#
kInt64 = 9#
kInt8 = 6#
kOptBool = 58#
kOptComplex128 = 72#
kOptComplex64 = 71#
kOptDouble = 70#
kOptFloat = 69#
kOptFloat16 = 68#
kOptInt16 = 65#
kOptInt32 = 66#
kOptInt64 = 67#
kOptInt8 = 64#
kOptSeqBool = 43#
kOptSeqComplex128 = 57#
kOptSeqComplex64 = 56#
kOptSeqDouble = 55#
kOptSeqFloat = 54#
kOptSeqFloat16 = 53#
kOptSeqInt16 = 50#
kOptSeqInt32 = 51#
kOptSeqInt64 = 52#
kOptSeqInt8 = 49#
kOptSeqString = 44#
kOptSeqUint16 = 46#
kOptSeqUint32 = 47#
kOptSeqUint64 = 48#
kOptSeqUint8 = 45#
kOptString = 59#
kOptUint16 = 61#
kOptUint32 = 62#
kOptUint64 = 63#
kOptUint8 = 60#
kSeqBool = 26#
kSeqComplex128 = 40#
kSeqComplex64 = 39#
kSeqDouble = 38#
kSeqFloat = 37#
kSeqFloat16 = 36#
kSeqInt16 = 33#
kSeqInt32 = 34#
kSeqInt64 = 35#
kSeqInt8 = 32#
kSeqMapInt64Float = 42#
kSeqMapStringFloat = 41#
kSeqString = 27#
kSeqUint16 = 29#
kSeqUint32 = 30#
kSeqUint64 = 31#
kSeqUint8 = 28#
kString = 1#
kUint16 = 3#
kUint2 = 22#
kUint32 = 4#
kUint4 = 20#
kUint64 = 5#
kUint8 = 2#
kUndefined = 73#
class onnx_light.onnx_op.TypeConstraintParam(*args, **kwargs)#

Specifies which tensor types are permitted for a named type parameter.

property allowed_type_strs#

(self) -> list[onnx_light.onnx_py._onnxpy.onnx_op.TensorType]

property description#

(self) -> str

property type_param_str#

(self) -> str

onnx_light.onnx_op.get_all_schemas() list[Any]#

Returns the latest LightOpSchema for every known operator.

For each (domain, name) pair, only the schema with the highest since_version is kept.

Returns:

The latest lightweight schema per operator.

Return type:

list[LightOpSchema]

onnx_light.onnx_op.get_all_schemas_with_history() list[Any]#

Returns every registered LightOpSchema, including past versions.

The returned list contains one LightOpSchema per (domain, name, since_version) triple known to the lightweight operator registry shipped with onnx_light. The ordering is the one used by the C++ extension and is stable across calls.

Returns:

All registered lightweight schemas, including historical opset versions.

Return type:

list[LightOpSchema]