cupy.unravel_index#
- cupy.unravel_index(indices, dims, order='C')[source]#
Converts array of flat indices into a tuple of coordinate arrays.
- Parameters:
indices (cupy.ndarray) – An integer array whose elements are indices into the flattened version of an array of dimensions
dims
.dims (tuple of ints) – The shape of the array to use for unraveling indices.
order ('C' or 'F') – Determines whether the indices should be viewed as indexing in row-major (C-style) or column-major (Fortran-style) order.
- Returns:
Each array in the tuple has the same shape as the indices array.
- Return type:
tuple of ndarrays
Examples
>>> cupy.unravel_index(cupy.array([22, 41, 37]), (7, 6)) (array([3, 6, 6]), array([4, 5, 1])) >>> cupy.unravel_index(cupy.array([31, 41, 13]), (7, 6), order='F') (array([3, 6, 6]), array([4, 5, 1]))
Warning
This function may synchronize the device.
See also