.xshape.shape_type_compute¶
- experimental_experiment.xshape.shape_type_compute.broadcast_shape(sh1: Tuple[int | torch.SymInt | torch.SymFloat | float | str, ...], sh2: Tuple[int | torch.SymInt | torch.SymFloat | float | str, ...], graph_builder: ShapeBuilder | None = None) Tuple[int | torch.SymInt | torch.SymFloat | float | str, ...][source]¶
Computes the shape for many broadcasting operators. This function should be used while converting the graph into ONNX because it assumes the broadcast is possible and adds the necessary constraints on the dynamic in the GraphBuilder shapes to make it work.
- 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.xshape.shape_type_compute.set_shape_type_custom(self: ShapeBuilder, node: NodeProto, exc: bool = False)[source]¶
Sets the shape and type if it can.
- experimental_experiment.xshape.shape_type_compute.set_shape_type_op_any(self: ShapeBuilder, node: NodeProto, exc: bool = False)[source]¶
Sets the shape and type if it can.
- experimental_experiment.xshape.shape_type_compute.set_type_shape_binary_op(g: ShapeBuilder, 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.xshape.shape_type_compute.set_type_shape_gemm(g: ShapeBuilder, name: str, x: str, y: str, transA: int, transB: int)[source]¶
Sets the output shape for node type Gemm.
- experimental_experiment.xshape.shape_type_compute.set_type_shape_matmul(g: ShapeBuilder, name: str, x: str, y: str) bool[source]¶
Sets the output shape for node type MatMul.
- experimental_experiment.xshape.shape_type_compute.set_type_shape_reduce_op(g: ShapeBuilder, name: str, x: str, keepdim: int, axes: Tuple[int] | None = None)[source]¶
Sets the output shape for any Reduce type.
- experimental_experiment.xshape.shape_type_compute.set_type_shape_reshape(g: ShapeBuilder, name: str, input_name: str, new_shape: Sequence[int])[source]¶
Sets the output shape for node type Reshape