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
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
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)