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{int, tuple of ints}

The shape of the desired array. A single integer i is interpreted as (i,).

Returns:
outdpnp.ndarray

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

Limitations

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

See also

dpnp.broadcast

Produce an object that mimics broadcasting.

dpnp.broadcast_arrays

Broadcast any number of arrays against each other.

dpnp.broadcast_shapes

Broadcast the input shapes into a single shape.

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]])