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
shapeandndimproperties.- Return type:
broadcast object
Limitations
Input arrays are not coerced, so array-like objects and scalars are not supported and
TypeErrorexception will be raised.See also
dpnp.broadcast_arraysBroadcast any number of arrays against each other.
dpnp.broadcast_shapesBroadcast the input shapes into a single shape.
dpnp.broadcast_toBroadcast an array to a new shape.
Notes
Iterator functionality is not supported.
The legacy
ndattribute ofnumpy.broadcastis not provided,ndimhas 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