mlx.core.broadcast_shapes#
- broadcast_shapes(*shapes: Sequence[int]) Tuple[int]#
Broadcast shapes.
Returns the shape that results from broadcasting the supplied array shapes against each other.
- 參數:
*shapes (Sequence[int]) -- The shapes to broadcast.
- 回傳值:
The broadcasted shape.
- 回傳值型別:
- 引發:
ValueError -- If the shapes cannot be broadcast.
範例
>>> mx.broadcast_shapes((1,), (3, 1)) (3, 1) >>> mx.broadcast_shapes((6, 7), (5, 6, 1), (7,)) (5, 6, 7) >>> mx.broadcast_shapes((5, 1, 4), (1, 3, 1)) (5, 3, 4)