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.ndarrayordpctl.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.ndarrayordpctl.tensor.usm_ndarray. Parameter mode is supported withwrap, the default, andclipvalues. Parameter axis is supported as integer only. Otherwise the function will be executed sequentially on CPU.See also
dpnp.putmaskChanges elements of an array based on conditional and input values.
dpnp.placeChange elements of an array based on conditional and input values.
dpnp.put_along_axisPut values into the destination array by matching 1d index and data slices.
Notes
In contrast to
numpy.putwrap mode which wraps indices around the array for cyclic operations,dpnp.putwrap 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])