Skip to content

broadcast_shapes

Broadcasts shapes against each other and returns the resulting shape.

Parameters:

Name Type Description Default
shapes tuple[int, ...]

Shapes to broadcast.

()

Returns:

Name Type Description
out tuple[int, ...]

The broadcasted shape.

Raises:

Type Description
ValueError

If the shapes are not broadcastable.

Source code in sparse/numba_backend/_coo/common.py
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
def broadcast_shapes(*shapes: tuple[int, ...]) -> tuple[int, ...]:
    """
    Broadcasts shapes against each other and returns the resulting shape.

    Parameters
    ----------
    shapes : tuple[int, ...]
        Shapes to broadcast.

    Returns
    -------
    out : tuple[int, ...]
        The broadcasted shape.

    Raises
    ------
    ValueError
        If the shapes are not broadcastable.
    """
    return np.broadcast_shapes(*shapes)