.xbuilder.shape_type_compute¶
- experimental_experiment.xbuilder.shape_type_compute.broadcast_shape(sh1: Tuple[int, ...], sh2: Tuple[int, ...], graph_builder: GraphBuilder | None = None) Tuple[int, ...] [source]¶
Computes the shape for many broadcasting operators.
- Parameters:
sh1 – first shape
sh2 – second shape
graph_builder – if not None, the function register any constraint which might appear while applying the broadcast
- Returns:
resulting shape
- experimental_experiment.xbuilder.shape_type_compute.prepare_inputs_homogeneous_operator(g: GraphBuilder, *args: Sequence[str], f: Callable | None = None, outputs: List[str] | None = None, name: str | None = None, sts: Any | None = None, check_shape: bool = True, op_type: str | None = None, use_left: bool = False, force_type: int | None = None) Tuple[str, ...] [source]¶
Casts any inputs to ensure all inputs share the same type.
op_type can be specified to bypass some cases with ambiguities such as a float multiplied with an integer.
- Parameters:
g – GraphBuilder
args – operator arguments
f – function calling the operator
outputs – output names
sts – known shapes and types
check_shape – extra verification for shapes
op_type – operator type (onnx name)
use_left – if the operator is in one inplaced modification then the type of the left side
force_type – if not None, choose this type and cast the inputs
- Returns:
new inputs
- experimental_experiment.xbuilder.shape_type_compute.set_shape_type_custom(self: GraphBuilder, node: NodeProto)[source]¶
Sets the shape and type if it can.
- experimental_experiment.xbuilder.shape_type_compute.set_shape_type_op_any(self: GraphBuilder, node: NodeProto)[source]¶
Sets the shape and type if it can.
- experimental_experiment.xbuilder.shape_type_compute.set_type_shape_binary_op(g: GraphBuilder, name: str, *input_names: List[str], begin: int = 0, cmp_op: bool = False, itype: int | None = None) bool [source]¶
Sets the shape and type for a binary operator (add, mul, …).
- experimental_experiment.xbuilder.shape_type_compute.set_type_shape_gemm(g: GraphBuilder, name: str, x: str, y: str, transA: int, transB: int)[source]¶
Sets the output shape for node type Gemm.
- experimental_experiment.xbuilder.shape_type_compute.set_type_shape_matmul(g: GraphBuilder, name: str, x: str, y: str) bool [source]¶
Sets the output shape for node type MatMul.
- experimental_experiment.xbuilder.shape_type_compute.set_type_shape_reduce_op(g: GraphBuilder, name: str, x: str, keepdim: int, axes: Tuple[int] | None = None)[source]¶
Sets the output shape for any Reduce type.