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
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
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)