Skip to content

Commit 1f0e9fd

Browse files
committed
Clean up top_k docstring
1 parent c37f1de commit 1f0e9fd

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

dpctl/tensor/_topk.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,24 @@ def top_k(x, k, /, *, axis=None, mode="largest"):
5656
over the flattened array. Default: ``None``.
5757
mode (Literal["largest", "smallest"]):
5858
search mode. Must be one of the following modes:
59-
- `"largest"`: return the `k` largest elements.
60-
- `"smallest"`: return the `k` smallest elements.
59+
60+
- `"largest"`: return the `k` largest elements.
61+
- `"smallest"`: return the `k` smallest elements.
62+
6163
Default: `"largest"`.
6264
6365
Returns:
64-
tuple[usm_ndarray, usm_ndarray]:
66+
tuple[usm_ndarray, usm_ndarray]
6567
a namedtuple `(values, indices)` whose
6668
67-
- first element `values` will be an array containing the `k` largest or
68-
smallest elements of `x`. The array has the same data type as `x`.
69-
If `axis` was `None`, `values` will be a one-dimensional array
70-
with shape `(k,)` and otherwise, `values` will have shape
71-
`x.shape[:axis] + (k,) + x.shape[axis+1:]`
72-
73-
- second element `indices` will be an array containing indices of `x`
74-
that result in `values`. The array will have the same shape as
75-
`values` and will have the default array index data type.
69+
* first element `values` will be an array containing the `k`
70+
largest or smallest elements of `x`. The array has the same data
71+
type as `x`. If `axis` was `None`, `values` will be a
72+
one-dimensional array with shape `(k,)` and otherwise, `values`
73+
will have shape `x.shape[:axis] + (k,) + x.shape[axis+1:]`
74+
* second element `indices` will be an array containing indices of
75+
`x` that result in `values`. The array will have the same shape
76+
as `values` and will have the default array index data type.
7677
"""
7778
largest = _get_top_k_largest(mode)
7879
if not isinstance(x, dpt.usm_ndarray):

0 commit comments

Comments
 (0)