experimental_experiment.xbuilder._onnx_helper¶
- experimental_experiment.xbuilder._onnx_helper.choose_consistent_domain_opset(domain: str, opsets: Dict[str, int] | None = None) int [source]¶
Chooses a compatible opset for a particular domain given this existing one. Only works for ai.onnx.ml, otherwise return 1.
- Parameters:
domain – new domain
opsets – existing opsets
- Returns:
version
- experimental_experiment.xbuilder._onnx_helper.compatible_opsets(domain: str, op_type: str, current: int, new_version: int) bool [source]¶
Tells if two opset version for a particular operator type means the same version of it.
- Parameters:
domain – domain, only ai.onnx and ai.onnx.ml are checked.
op_type – operator type
current – current domain version
new_version – new version
- Returns:
result
- experimental_experiment.xbuilder._onnx_helper.element_wise_binary_op_types() Set[str] [source]¶
Returns the list of element-wise operators.
<<<
import pprint from experimental_experiment.xbuilder._onnx_helper import ( element_wise_binary_op_types, ) pprint.pprint(element_wise_binary_op_types())
>>>
{'Or', 'Div', 'Mul', 'And', 'Mod', 'Add', 'Sub', 'Xor'}
- experimental_experiment.xbuilder._onnx_helper.element_wise_op_cmp_types() Set[str] [source]¶
Returns the list of element-wise operators doing comparisons.
<<<
import pprint from experimental_experiment.xbuilder._onnx_helper import element_wise_op_cmp_types pprint.pprint(element_wise_op_cmp_types())
>>>
{'GreaterOrEqual', 'Equal', 'Less', 'LessOrEqual', 'Greater'}
- experimental_experiment.xbuilder._onnx_helper.enumerate_subgraphs(node: NodeProto, recursive: bool = True) Iterator[Tuple[Tuple[NodeProto, str, GraphProto], ...]] [source]¶
Returns the subgraphs inside a graph.
- experimental_experiment.xbuilder._onnx_helper.same_function_proto(f1: FunctionProto, f2: FunctionProto, verbose: int = 0) str | bool [source]¶
Compares two functions and tells if they are equal.
- Parameters:
f1 – first function
f2 – second function
verbose – to know why the comparison failed, the function returns a string in that case or True
- Returns:
comparison
They may have different names.
- experimental_experiment.xbuilder._onnx_helper.unary_like_op_types() Set[str] [source]¶
Returns the list of unary like operators. They do not change the shape. They may change the type.
<<<
import pprint from experimental_experiment.xbuilder._onnx_helper import unary_like_op_types pprint.pprint(unary_like_op_types())
>>>
{'Abs', 'Acos', 'Acosh', 'Asin', 'Asinh', 'Atan', 'Atanh', 'BitShift', 'Cast', 'CastLike', 'Ceil', 'Celu', 'Clip', 'Cos', 'Cosh', 'DequantizeLinear', 'DynamicQuantizeLinear', 'Elu', 'Erf', 'Exp', 'IsInf', 'Log', 'LogSoftmax', 'Neg', 'Not', 'PRelu', 'QuantizeLinear', 'Reciprocal', 'Relu', 'Round', 'Selu', 'Sigmoid', 'Sign', 'Sin', 'Sinh', 'Softmax', 'SoftmaxCrossEntropyLoss', 'Softplus', 'Softsign', 'Sqrt', 'Tan', 'Tanh', 'ThresholdRelu'}