Skip to content

Commit

Permalink
Changes to choose docstring
Browse files Browse the repository at this point in the history
Fix spacing in choices type list

Fix spacing in example arrays
  • Loading branch information
ndgrigorian committed Dec 26, 2024
1 parent ecd31f3 commit 131308f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dpnp/dpnp_iface_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ def choose(a, choices, out=None, mode="wrap"):
in `choices` to choose from. Behavior of out-of-bounds integers (i.e.,
integers outside of `[0, n-1]` where `n` is the number of choices) is
determined by the `mode` keyword.
choices : {dpnp.ndarray, usm_ndarray, sequence of dpnp.ndarrays and
usm_ndarrays}
choices : {dpnp.ndarray, usm_ndarray, \
sequence of dpnp.ndarrays and usm_ndarrays}
Choice arrays. `a` and choice arrays must be broadcast-compatible.
If `choices` is an array, the array is unstacked into a sequence of
arrays.
Expand Down Expand Up @@ -233,20 +233,20 @@ def choose(a, choices, out=None, mode="wrap"):
... # will be the second element of the fourth (3+1) choice array, i.e.,
... # 31, etc.
... )
array([20, 31, 12, 3])
array([20, 31, 12, 3])
>>> np.choose(np.array([2, 4, 1, 0]), choices, mode='clip'
... # 4 goes to 3 (4-1)
... )
array([20, 31, 12, 3])
array([20, 31, 12, 3])
>>> # because there are 4 choice arrays
>>> np.choose(np.array([2, 4, 1, 0]), choices, mode='wrap'
... # 4 is clipped to 3
... )
array([20, 31, 12, 3])
array([20, 31, 12, 3])
>>> np.choose(np.array([2, -1, 1, 0]), choices, mode='wrap'
... # -1 goes to 3 (-1+4)
... )
array([20, 31, 12, 3])
array([20, 31, 12, 3])
An example using broadcasting:
Expand Down

0 comments on commit 131308f

Please sign in to comment.