bundles / numpy 2.4.3 / numpy / broadcast_shapes
function
numpy:broadcast_shapes
Signature
def broadcast_shapes(*args)Summary
Broadcast the input shapes into a single shape.
Extended Summary
Parameters
*args: tuples of ints, or intsThe shapes to be broadcast against each other.
Returns
: tupleBroadcasted shape.
Raises
: ValueErrorIf the shapes are not compatible and cannot be broadcast according to NumPy's broadcasting rules.
Examples
import numpy as np np.broadcast_shapes((1, 2), (3, 1), (3, 2))✓
(3, 2)
np.broadcast_shapes((6, 7), (5, 6, 1), (7,), (5, 1, 7))
✓(5, 6, 7)
See also
Aliases
numpy.broadcast_shapes