jax.numpy.broadcast_to

Contents

jax.numpy.broadcast_to#

jax.numpy.broadcast_to(array, shape)[source]#

Broadcast an array to a new shape.

LAX-backend implementation of numpy.broadcast_to().

The JAX version does not necessarily return a view of the input.

Original docstring below.

Parameters:
  • array (array_like) – The array to broadcast.

  • shape (tuple or int) – The shape of the desired array. A single integer i is interpreted as (i,).

Returns:

broadcast – A readonly view on the original array with the given shape. It is typically not contiguous. Furthermore, more than one element of a broadcasted array may refer to a single memory location.

Return type:

array