chainerx.take

chainerx.take(a, indices, axis)

Takes elements from an array along an axis.

Parameters
  • a (ndarray) – Source array.

  • indices (ndarray) – The indices of the values to extract. When indices are out of bounds, they are wrapped around.

  • axis (int) – The axis over which to select values.

  • mode (str) – Specifies how out-of-bounds indices will behave. ‘raise’ - raise an error ‘wrap’ - wrap around ‘clip’ - clip to the range

Returns

Output array.

Return type

ndarray()

Note

This function currently does not support axis=None

Note

During backpropagation, this function propagates the gradient of the output array to the input array a.

Note

The default mode for the native backend is ‘raise’, while for the cuda backend is ‘wrap’ in order to prevent device synchronization. ‘raise’ mode is currently not supported in the CUDA backend.

See also

numpy.take()