cupynumeric.indices#
- cupynumeric.indices(dimensions: Sequence[int], dtype: npt.DTypeLike = <class 'int'>, sparse: bool = False) ndarray | tuple[ndarray, ...] #
Return an array representing the indices of a grid. Compute an array where the subarrays contain index values 0, 1, … varying only along the corresponding axis.
- Parameters:
- Returns:
grid – If sparse is False returns one array of grid indices,
grid.shape = (len(dimensions),) + tuple(dimensions)
. If sparse is True returns a tuple of arrays, withgrid[i].shape = (1, ..., 1, dimensions[i], 1, ..., 1)
with dimensions[i] in the ith place- Return type:
See also
Notes
The output shape in the dense case is obtained by prepending the number of dimensions in front of the tuple of dimensions, i.e. if dimensions is a tuple
(r0, ..., rN-1)
of lengthN
, the output shape is(N, r0, ..., rN-1)
. The subarraysgrid[k]
contains the N-D array of indices along thek-th
axis. Explicitly:grid[k, i0, i1, …, iN-1] = ik
- Availability:
Multiple GPUs, Multiple CPUs