tf.keras.ops.unravel_index

Convert flat indices to coordinate arrays in a given array shape.

indices An integer or array of integers representing flat indices.
shape The shape of the array to unravel into.

Tuple of arrays for each dimension with unraveled indices.

Example:

indices = 5
shape = (3, 3)
unravel_index(indices, shape)
(1, 2)  # 5 is at row 1, column 2 in a 3x3 array