broadcast_shape¶
- paddle. broadcast_shape ( x_shape: Sequence[int], y_shape: Sequence[int] ) list[int] [source]
-
The function returns the shape of doing operation with broadcasting on tensors of x_shape and y_shape.
Note
If you want know more about broadcasting, please refer to Introduction to Tensor .
- Parameters
-
x_shape (list[int]|tuple[int]) – A shape of tensor.
y_shape (list[int]|tuple[int]) – A shape of tensor.
- Returns
-
list[int], the result shape.
Examples
>>> import paddle >>> shape = paddle.broadcast_shape([2, 1, 3], [1, 3, 1]) >>> shape [2, 3, 3] >>> # shape = paddle.broadcast_shape([2, 1, 3], [3, 3, 1]) >>> # ValueError (terminated with error message).