onnx.defs¶
Opset 版本¶
算子和函数模式¶
- onnx.defs.has()¶
has_schema(*args, **kwargs) 重载函数。
has_schema(op_type: str, domain: str = ‘’) -> bool
has_schema(op_type: str, max_inclusive_version: int, domain: str = ‘’) -> bool
- onnx.defs.get_schema(*args, **kwargs)¶
重载函数。
get_schema(op_type: str, max_inclusive_version: int, domain: str = ‘’) -> onnx.onnx_cpp2py_export.defs.OpSchema
返回算子 op_type 特定版本的模式。
get_schema(op_type: str, domain: str = ‘’) -> onnx.onnx_cpp2py_export.defs.OpSchema
返回算子 op_type 特定版本的模式。
- onnx.defs.get_all_schemas() list[onnx.onnx_cpp2py_export.defs.OpSchema] ¶
返回最新版本所有现有算子的模式。
- onnx.defs.get_all_schemas_with_history() list[onnx.onnx_cpp2py_export.defs.OpSchema] ¶
返回所有现有算子及其所有版本的模式。
class OpSchema
¶
- class onnx.defs.OpSchema¶
算子的模式。
- class AttrType¶
成员
FLOAT
INT
STRING
TENSOR
GRAPH
FLOATS
INTS
STRINGS
TENSORS
GRAPHS
SPARSE_TENSOR
SPARSE_TENSORS
TYPE_PROTO
TYPE_PROTOS
- FLOAT = <AttrType.FLOAT: 1>¶
- FLOATS = <AttrType.FLOATS: 6>¶
- GRAPH = <AttrType.GRAPH: 5>¶
- GRAPHS = <AttrType.GRAPHS: 10>¶
- INT = <AttrType.INT: 2>¶
- INTS = <AttrType.INTS: 7>¶
- SPARSE_TENSOR = <AttrType.SPARSE_TENSOR: 11>¶
- SPARSE_TENSORS = <AttrType.SPARSE_TENSORS: 12>¶
- STRING = <AttrType.STRING: 3>¶
- STRINGS = <AttrType.STRINGS: 8>¶
- TENSOR = <AttrType.TENSOR: 4>¶
- TENSORS = <AttrType.TENSORS: 9>¶
- TYPE_PROTO = <AttrType.TYPE_PROTO: 13>¶
- TYPE_PROTOS = <AttrType.TYPE_PROTOS: 14>¶
- property name¶
- property value¶
- class Attribute¶
- property default_value¶
- property description¶
- property name¶
- property required¶
- property type¶
- class DifferentiationCategory¶
成员
Unknown
Differentiable
NonDifferentiable
- Differentiable = <DifferentiationCategory.Differentiable: 1>¶
- NonDifferentiable = <DifferentiationCategory.NonDifferentiable: 2>¶
- Unknown = <DifferentiationCategory.Unknown: 0>¶
- property name¶
- property value¶
- class FormalParameter¶
- property description¶
- property differentiation_category¶
- property is_homogeneous¶
- property min_arity¶
- property name¶
- property option¶
- property type_str¶
- property types¶
- class FormalParameterOption¶
成员
Single
Optional
Variadic
- Optional = <FormalParameterOption.Optional: 1>¶
- Single = <FormalParameterOption.Single: 0>¶
- Variadic = <FormalParameterOption.Variadic: 2>¶
- property name¶
- property value¶
- class SupportType¶
成员
COMMON
EXPERIMENTAL
- COMMON = <SupportType.COMMON: 0>¶
- EXPERIMENTAL = <SupportType.EXPERIMENTAL: 1>¶
- property name¶
- property value¶
- class TypeConstraintParam¶
- property allowed_type_strs¶
- property description¶
- property type_param_str¶
- property all_function_opset_versions¶
- property attributes¶
- 属性 context_dependent_function_opset_versions¶
- 属性 deprecated¶
- 属性 doc¶
- 属性 domain¶
- 属性 file¶
- 属性 function_body¶
- 属性 function_opset_versions¶
- get_context_dependent_function(self: onnx.onnx_cpp2py_export.defs.OpSchema, arg0: bytes, arg1: list[bytes]) bytes ¶
- get_context_dependent_function_with_opset_version(self: onnx.onnx_cpp2py_export.defs.OpSchema, arg0: int, arg1: bytes, arg2: list[bytes]) bytes ¶
- get_function_with_opset_version(self: onnx.onnx_cpp2py_export.defs.OpSchema, arg0: int) bytes ¶
- get_type_and_shape_inference_function(self: onnx.onnx_cpp2py_export.defs.OpSchema) Callable[[onnx::InferenceContext], None] ¶
- 属性 has_context_dependent_function¶
- 属性 has_data_propagation_function¶
- 属性 has_function¶
- 属性 has_type_and_shape_inference_function¶
- 属性 inputs¶
- 属性 line¶
- 属性 max_input¶
- 属性 max_output¶
- 属性 min_input¶
- 属性 min_output¶
- 属性 name¶
- 属性 outputs¶
- set_type_and_shape_inference_function(self: onnx.onnx_cpp2py_export.defs.OpSchema, arg0: Callable[[onnx::InferenceContext], None]) onnx.onnx_cpp2py_export.defs.OpSchema ¶
- 属性 since_version¶
- 属性 support_level¶
- 属性 type_constraints¶
异常¶
- 类 onnx.defs.SchemaError¶
常量¶
onnx 包中官方支持的域。
from onnx.defs import (
ONNX_DOMAIN,
ONNX_ML_DOMAIN,
AI_ONNX_PREVIEW_TRAINING_DOMAIN,
)
print(f"ONNX_DOMAIN={ONNX_DOMAIN!r}")
print(f"ONNX_ML_DOMAIN={ONNX_ML_DOMAIN!r}")
print(f"AI_ONNX_PREVIEW_TRAINING_DOMAIN={AI_ONNX_PREVIEW_TRAINING_DOMAIN!r}")
ONNX_DOMAIN=''
ONNX_ML_DOMAIN='ai.onnx.ml'
AI_ONNX_PREVIEW_TRAINING_DOMAIN='ai.onnx.preview.training'