dpnp.put
- dpnp.put(a, indices, vals, /, *, axis=None, mode='wrap')[source]
Puts values of an array into another array along a given axis.
For full documentation refer to
numpy.put
.Limitations
Parameters a and indices are supported either as
dpnp.ndarray
ordpctl.tensor.usm_ndarray
. Parameter indices is supported as 1-D array of integer data type. Parameter vals must be broadcastable to the shape of indices and has the same data type as a if it is asdpnp.ndarray
ordpctl.tensor.usm_ndarray
. Parameter mode is supported withwrap
, the default, andclip
values. Parameter axis is supported as integer only. Otherwise the function will be executed sequentially on CPU.See also
dpnp.putmask
Changes elements of an array based on conditional and input values.
dpnp.place
Change elements of an array based on conditional and input values.
dpnp.put_along_axis
Put values into the destination array by matching 1d index and data slices.
Notes
In contrast to
numpy.put
wrap mode which wraps indices around the array for cyclic operations,dpnp.put
wrap mode clamps indices to a fixed range within the array boundaries (-n <= i < n).Examples
>>> import dpnp as np >>> x = np.arange(5) >>> indices = np.array([0, 1]) >>> np.put(x, indices, [-44, -55]) >>> x array([-44, -55, 2, 3, 4])
>>> x = np.arange(5) >>> indices = np.array([22]) >>> np.put(x, indices, -5, mode='clip') >>> x array([ 0, 1, 2, 3, -5])