dpctl.tensor.take(x, indices, axis=None, mode='wrap')[source]

Takes elements from an array along a given axis at given indices.

  • x (usm_ndarray) – The array that elements will be taken from.

  • indices (usm_ndarray) – One-dimensional array of indices.

  • axis (int, optional) – The axis along which the values will be selected. If x is one-dimensional, this argument is optional. Default: None.

  • mode (str, 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".


Array with shape x.shape[:axis] + indices.shape + x.shape[axis + 1:] filled with elements from x.

Return type: