dpnp.tensor.put_along_axis¶
- dpnp.tensor.put_along_axis(x, indices, vals, /, *, axis=-1, mode='wrap')[source]¶
Puts elements into an array at the one-dimensional indices specified by
indicesalong a providedaxis.- Parameters:
x (usm_ndarray) -- input array. Must be compatible with
indices, except for the axis (dimension) specified byaxis.indices (usm_ndarray) -- array indices. Must have the same rank (i.e., number of dimensions) as
x.vals (usm_ndarray) -- Array of values to be put into
x. Must be broadcastable to the shape ofindices.axis (int, optional) --
axis along which to select values. If
axisis negative, the function determines the axis along which to select values by counting from the last dimension.Default:
-1.mode ({"wrap", "clip"}, optional) --
How out-of-bounds indices will be handled. Possible values are:
"wrap": clamps indices to (-n <= i < n), then wraps negative indices."clip": clips indices to (0 <= i < n).
Default:
"wrap".
Notes
If input array
indicescontains duplicates, a race condition occurs, and the value written into corresponding positions inxmay vary from run to run. Preserving sequential semantics in handing the duplicates to achieve deterministic behavior requires additional work.