broadcast_shape¶
- paddle. broadcast_shape ( x_shape, y_shape ) [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).