broadcast_shapes#

ivy.broadcast_shapes(*shapes)[source]#

Broadcasts shapes.

Parameters:

shapes (Union[List[int], List[Tuple]]) – The shapes to broadcast.

Return type:

Tuple[int]

Returns:

ret – The broadcasted shape.

Examples

>>> x = [(3, 3), (3, 1)]
>>> print(ivy.broadcast_shapes(*x))
(3, 3)
>>> print(ivy.broadcast_shapes(*[(3, 3),(3, 1),(1, 3)]))
(3, 3)
Container.broadcast_shapes(self, /, *, out=None)[source]#

ivy.Container instance method variant of ivy.broadcast_shapes. This method simply wraps the function, and so the docstring for ivy.broadcast_shapes also applies to this method with minimal changes.

Parameters:

self (Container) – the container with shapes to broadcast.

Return type:

Container

Returns:

ret – Container with broadcasted shapes.

Examples

>>> shapes = ivy.Container(a = (2, 3, 5),
...                        b = (2, 3, 1))
>>> z = shapes.broadcast_shapes()
>>> print(z)
{
    a: [2, 3, 5],
    b: [2, 3, 1]
}