yobx.xshape._onnx_helper¶
- yobx.xshape._onnx_helper.element_wise_binary_op_types() Set[str][source][source]¶
Returns the list of element-wise operators.
<<<
import pprint from yobx.xshape._onnx_helper import ( element_wise_binary_op_types, ) pprint.pprint(element_wise_binary_op_types())
>>>
{'Add', 'And', 'BitwiseAnd', 'BitwiseOr', 'BitwiseXor', 'Div', 'Max', 'Mean', 'Min', 'Mod', 'Mul', 'Or', 'Sub', 'Sum', 'Xor'}
- yobx.xshape._onnx_helper.element_wise_op_cmp_types() Set[str][source][source]¶
Returns the list of element-wise operators doing comparisons.
<<<
import pprint from yobx.xshape._onnx_helper import element_wise_op_cmp_types pprint.pprint(element_wise_op_cmp_types())
>>>
{'GreaterOrEqual', 'Equal', 'Greater', 'Less', 'LessOrEqual'}
- yobx.xshape._onnx_helper.enumerate_subgraphs(graph: GraphProto) Iterator[GraphProto][source][source]¶
Enumerates all inputs from a node including all the hidden inputs from subgraphs.
- yobx.xshape._onnx_helper.overwrite_shape_in_model_proto(model: ModelProto, n_in: int | None = None) ModelProto[source][source]¶
Removes inferred shapes. Overwrites input shapes to make them all dynamic.
n_inindicates the number of inputs for which the shape must be rewritten.
- yobx.xshape._onnx_helper.replace_static_dimensions_by_strings(model: ModelProto) Tuple[ModelProto, Dict[str, str | int]][source][source]¶
Replaces static dimensions by dynamic dimensions in a model.
- Parameters:
model – ModelProto
- Returns:
the modified model, a mapping
{new_name: value}
- yobx.xshape._onnx_helper.str_tensor_proto_type() str[source][source]¶
Returns the following string:
<<<
from yobx.xshape._onnx_helper import str_tensor_proto_type print(str_tensor_proto_type())
>>>
0:UNDEFINED, 1:FLOAT, 2:UINT8, 3:INT8, 4:UINT16, 5:INT16, 6:INT32, 7:INT64, 8:STRING, 9:BOOL, 10:FLOAT16, 11:DOUBLE, 12:UINT32, 13:UINT64, 14:COMPLEX64, 15:COMPLEX128, 16:BFLOAT16, 17:FLOAT8E4M3FN, 18:FLOAT8E4M3FNUZ, 19:FLOAT8E5M2, 20:FLOAT8E5M2FNUZ, 21:UINT4, 22:INT4, 23:FLOAT4E2M1, 24:FLOAT8E8M0, 25:UINT2, 26:INT2
- yobx.xshape._onnx_helper.unary_like_op_types() Set[str][source][source]¶
Returns the list of unary like operators. They do not change the shape. They may change the type.
<<<
import pprint from yobx.xshape._onnx_helper import unary_like_op_types pprint.pprint(unary_like_op_types())
>>>
{'Abs', 'Acos', 'Acosh', 'Asin', 'Asinh', 'Atan', 'Atanh', 'BitShift', 'BitwiseNot', 'Cast', 'CastLike', 'Ceil', 'Celu', 'Clip', 'Cos', 'Cosh', 'CumSum', 'DequantizeLinear', 'DynamicQuantizeLinear', 'Elu', 'Erf', 'Exp', 'Floor', 'HardSigmoid', 'HardSwish', 'IsInf', 'LRN', 'LeakyRelu', 'Log', 'LogSoftmax', 'LpNormalization', 'MeanVarianceNormalization', 'Mish', 'Neg', 'Not', 'PRelu', 'QuantizeLinear', 'Reciprocal', 'Relu', 'Round', 'Selu', 'Shrink', 'Sigmoid', 'Sign', 'Sin', 'Sinh', 'Softmax', 'SoftmaxCrossEntropyLoss', 'Softplus', 'Softsign', 'Sqrt', 'Tan', 'Tanh', 'ThresholdRelu', 'ThresholdedRelu', 'Trilu', 'Trunc'}