mlx.core.broadcast_to

mlx.core.broadcast_to#

broadcast_to(a: scalar | array, /, shape: Sequence[int], *, stream: None | Stream | Device = None) array#

Broadcast an array to the given shape.

The broadcasting semantics are the same as Numpy.

参数:
  • a (array) -- Input array.

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

返回:

The output array with the new shape.

返回类型:

array