Searching#

ivy.unravel_index(indices, shape, /, *, out=None)[source]#

Convert a flat index or array of flat indices into a tuple of coordinate arrays.

Parameters:
  • indices (Union[Array, NativeArray]) – Input array.

  • shape (Tuple[int]) – The shape of the array to use for unraveling indices.

  • out (Optional[Array], default: None) – optional output array, for writing the result to.

Return type:

Tuple[Array]

Returns:

ret – Tuple with arrays of type int32 that have the same shape as the indices array.

Examples

>>> indices = ivy.array([22, 41, 37])
>>> ivy.unravel_index(indices, (7,6))
(ivy.array([3, 6, 6]), ivy.array([4, 5, 1]))

This should have hopefully given you an overview of the searching submodule, if you have any questions, please feel free to reach out on our discord!