dpnp.unravel_index
- dpnp.unravel_index(indices, shape, order='C')[source]
Converts array of flat indices into a tuple of coordinate arrays.
For full documentation refer to
numpy.unravel_index
.- Parameters:
indices ({dpnp.ndarray, usm_ndarray}) -- An integer array whose elements are indices into the flattened version of an array of dimensions shape.
shape (tuple or list of ints) -- The shape of the array to use for unraveling indices.
order ({None, "C", "F"}, optional) -- Determines whether the indices should be viewed as indexing in row-major (C-style) or column-major (Fortran-style) order. Default:
"C"
.
- Returns:
unraveled_coords -- Each array in the tuple has the same shape as the indices array.
- Return type:
tuple of dpnp.ndarray
See also
dpnp.ravel_multi_index
Converts a tuple of index arrays into an array of flat indices.
Examples
>>> import dpnp as np >>> np.unravel_index(np.array([22, 41, 37]), (7, 6)) (array([3, 6, 6]), array([4, 5, 1])) >>> np.unravel_index(np.array([31, 41, 13]), (7, 6), order="F") (array([3, 6, 6]), array([4, 5, 1]))
>>> np.unravel_index(np.array(1621), (6, 7, 8, 9)) (array(3), array(1), array(4), array(1))