mlx.core.broadcast_to#

mlx.core.broadcast_to(a: Union[scalar, array], /, shape: List[int], *, stream: Union[None, Stream, Device] = None) array#

Broadcast an array to the given shape.

The broadcasting semantics are the same as Numpy.

Parameters:
  • a (array) – Input array.

  • shape (list(int)) – The shape to broadcast to.

Returns:

The output array with the new shape.

Return type:

array