onnx_ir.schemasΒΆ
See Writing transformation passes for using schema and opset requirements in transformation pipelines.
The onnx_ir.schemas module provides classes for representing operator signatures and their parameters. These classes are useful for introspecting operator definitions and validating operator usage.
OpSignatureΒΆ
The OpSignature class represents the schema for an ONNX operator, including its inputs, outputs, and attributes.
- class onnx_ir.schemas.OpSignature(domain, name, overload, params, outputs, since_version=1)[source]ΒΆ
Schema for an operator.
- Parameters:
- paramsΒΆ
Input parameters. When the op is an ONNX function definition, the order is according to the function signature. This mean we can interleave ONNX inputs and ONNX attributes in the list.
- outputsΒΆ
Output parameters.
- property attributes: Sequence[AttributeParameter]ΒΆ
The attribute parameters.
- classmethod from_op_schema(op_schema)[source]ΒΆ
Produce an OpSignature from an ONNX OpSchema.
- Parameters:
op_schema (OpSchema)
- Return type:
- get(name, default=None)[source]ΒΆ
Return a parameter by name, or
defaultwhen missing.- Parameters:
name (str)
default (Parameter | AttributeParameter | None)
- Return type:
Parameter | AttributeParameter | None
ParameterΒΆ
The Parameter class represents a formal input parameter of an operator.
AttributeParameterΒΆ
The AttributeParameter class represents an attribute parameter in the operator signature.
- class onnx_ir.schemas.AttributeParameter(name, type, required, default=None)[source]ΒΆ
A parameter in the function signature that represents an ONNX attribute.
- Parameters:
name (str)
type (AttributeType)
required (bool)
default (Attr | None)
TypeConstraintParamΒΆ
The TypeConstraintParam class represents type constraints for parameters, specifying which types are allowed.