dpnp.broadcast

class dpnp.broadcast(*args)[source]

Produce an object that mimics broadcasting.

For full documentation refer to numpy.broadcast.

Parameters:

*args ({dpnp.ndarray, usm_ndarray}) -- Input arrays to broadcast against one another.

Returns:

broadcast -- Broadcast the input parameters against one another, and return an object that encapsulates the result. Amongst others, it has shape and ndim properties.

Return type:

broadcast object

Limitations

Input arrays are not coerced, so array-like objects and scalars are not supported and TypeError exception will be raised.

See also

dpnp.broadcast_arrays

Broadcast any number of arrays against each other.

dpnp.broadcast_shapes

Broadcast the input shapes into a single shape.

dpnp.broadcast_to

Broadcast an array to a new shape.

Notes

Iterator functionality is not supported.

The legacy nd attribute of numpy.broadcast is not provided, ndim has to be used instead.

Examples

>>> import dpnp as np
>>> x = np.array([[1], [2], [3]])
>>> y = np.array([4, 5, 6])
>>> b = np.broadcast(x, y)
>>> b.shape
(3, 3)
>>> b.ndim
2
>>> b.size
9

Attributes

ndim

Number of dimensions of the broadcasted result.

numiter

Number of iterators possessed by the broadcast object.

shape

Shape of the broadcasted result.

size

Total size of the broadcasted result.

values

The input arrays broadcast against one another.