@@ -1471,15 +1471,17 @@ def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
1471
1471
multi_index : tuple of {dpnp.ndarray, usm_ndarray}
1472
1472
A tuple of integer arrays, one array for each dimension.
1473
1473
dims : tuple or list of ints
1474
- The shape of array into which the indices from `` multi_index` ` apply.
1474
+ The shape of array into which the indices from `multi_index` apply.
1475
1475
mode : {"raise", "wrap" or "clip'}, optional
1476
1476
Specifies how out-of-bounds indices are handled. Can specify either
1477
1477
one mode or a tuple of modes, one mode per index:
1478
- - "raise" -- raise an error
1479
- - "wrap" -- wrap around
1480
- - "clip" -- clip to the range
1481
- In "clip" mode, a negative index which would normally wrap will
1482
- clip to 0 instead.
1478
+
1479
+ - "raise" -- raise an error
1480
+ - "wrap" -- wrap around
1481
+ - "clip" -- clip to the range
1482
+
1483
+ In ``"clip"`` mode, a negative index which would normally wrap will
1484
+ clip to 0 instead.
1483
1485
Default: ``"raise"``.
1484
1486
order : {None, "C", "F"}, optional
1485
1487
Determines whether the multi-index should be viewed as indexing in
@@ -1490,7 +1492,7 @@ def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
1490
1492
-------
1491
1493
raveled_indices : dpnp.ndarray
1492
1494
An array of indices into the flattened version of an array of
1493
- dimensions `` dims` `.
1495
+ dimensions `dims`.
1494
1496
1495
1497
See Also
1496
1498
--------
@@ -1509,6 +1511,7 @@ def ravel_multi_index(multi_index, dims, mode="raise", order="C"):
1509
1511
array([22, 23, 19])
1510
1512
>>> np.ravel_multi_index(arr, (4, 4), mode=("clip", "wrap"))
1511
1513
array([12, 13, 13])
1514
+
1512
1515
>>> arr = np.array([3, 1, 4, 1])
1513
1516
>>> np.ravel_multi_index(arr, (6, 7, 8, 9))
1514
1517
array(1621)
@@ -2316,17 +2319,18 @@ def triu_indices_from(arr, k=0):
2316
2319
2317
2320
2318
2321
def unravel_index (indices , shape , order = "C" ):
2319
- """Converts array of flat indices into a tuple of coordinate arrays.
2322
+ """
2323
+ Converts array of flat indices into a tuple of coordinate arrays.
2320
2324
2321
2325
For full documentation refer to :obj:`numpy.unravel_index`.
2322
2326
2323
2327
Parameters
2324
2328
----------
2325
2329
indices : {dpnp.ndarray, usm_ndarray}
2326
2330
An integer array whose elements are indices into the flattened version
2327
- of an array of dimensions `` shape` `.
2331
+ of an array of dimensions `shape`.
2328
2332
shape : tuple or list of ints
2329
- The shape of the array to use for unraveling `` indices` `.
2333
+ The shape of the array to use for unraveling `indices`.
2330
2334
order : {None, "C", "F"}, optional
2331
2335
Determines whether the indices should be viewed as indexing in
2332
2336
row-major (C-style) or column-major (Fortran-style) order.
@@ -2342,10 +2346,9 @@ def unravel_index(indices, shape, order="C"):
2342
2346
:obj:`dpnp.ravel_multi_index` : Converts a tuple of index arrays into an
2343
2347
array of flat indices.
2344
2348
2345
-
2346
2349
Examples
2347
2350
--------
2348
- import dpnp as np
2351
+ >>> import dpnp as np
2349
2352
>>> np.unravel_index(np.array([22, 41, 37]), (7, 6))
2350
2353
(array([3, 6, 6]), array([4, 5, 1]))
2351
2354
>>> np.unravel_index(np.array([31, 41, 13]), (7, 6), order="F")
0 commit comments