jax.numpy.ravel_multi_index(multi_index, dims, mode='raise', order='C')[source]

Converts a tuple of index arrays into an array of flat

LAX-backend implementation of ravel_multi_index().

Original docstring below.

indices, applying boundary modes to the multi-index.

  • multi_index (tuple of array_like) – A tuple of integer arrays, one array for each dimension.

  • dims (tuple of ints) – The shape of array into which the indices from multi_index apply.

  • mode ({'raise', 'wrap', 'clip'}, optional) –

    Specifies how out-of-bounds indices are handled. Can specify either one mode or a tuple of modes, one mode per index.

    • ’raise’ – raise an error (default)

    • ’wrap’ – wrap around

    • ’clip’ – clip to the range

    In ‘clip’ mode, a negative index which would normally wrap will clip to 0 instead.

  • order ({'C', 'F'}, optional) – Determines whether the multi-index should be viewed as indexing in row-major (C-style) or column-major (Fortran-style) order.


raveled_indices – An array of indices into the flattened version of an array of dimensions dims.

Return type