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