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 indices along a provided axis.

Parameters:
  • x (usm_ndarray) -- input array. Must be compatible with indices, except for the axis (dimension) specified by axis.

  • 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 of indices.

  • axis (int, optional) --

    axis along which to select values. If axis is 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 indices contains duplicates, a race condition occurs, and the value written into corresponding positions in x may vary from run to run. Preserving sequential semantics in handing the duplicates to achieve deterministic behavior requires additional work.