dpnp.broadcast_to

dpnp.broadcast_to(array, /, shape, subok=False)[source]

Broadcast an array to a new shape.

For full documentation refer to numpy.broadcast_to.

Parameters:
  • array ({dpnp.ndarray, usm_ndarray}) -- The array to broadcast.

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

Returns:

out -- An array having a specified shape. Must have the same data type as array.

Return type:

dpnp.ndarray

Limitations

Parameter subok is supported with default value. Otherwise NotImplementedError exception will be raised.

See also

dpnp.broadcast_arrays

Broadcast any number of arrays against each other.

Examples

>>> import dpnp as np
>>> x = np.array([1, 2, 3])
>>> np.broadcast_to(x, (3, 3))
array([[1, 2, 3],
       [1, 2, 3],
       [1, 2, 3]])