Skip to content

Commit 11273e6

Browse files
authored
docs: clarify shape of values and order of counts (#752)
1 parent 6e9c487 commit 11273e6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: src/array_api_stubs/_draft/set_functions.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ def unique_all(x: array, /) -> Tuple[array, array, array, array]:
3434
out: Tuple[array, array, array, array]
3535
a namedtuple ``(values, indices, inverse_indices, counts)`` whose
3636
37-
- first element must have the field name ``values`` and must be an array containing the unique elements of ``x``. The array must have the same data type as ``x``.
38-
- second element must have the field name ``indices`` and must be an array containing the indices (first occurrences) of ``x`` that result in ``values``. The array must have the same shape as ``values`` and must have the default array index data type.
37+
- first element must have the field name ``values`` and must be a one-dimensional array containing the unique elements of ``x``. The array must have the same data type as ``x``.
38+
- second element must have the field name ``indices`` and must be an array containing the indices (first occurrences) of a flattened ``x`` that result in ``values``. The array must have the same shape as ``values`` and must have the default array index data type.
3939
- third element must have the field name ``inverse_indices`` and must be an array containing the indices of ``values`` that reconstruct ``x``. The array must have the same shape as ``x`` and must have the default array index data type.
40-
- fourth element must have the field name ``counts`` and must be an array containing the number of times each unique element occurs in ``x``. The returned array must have same shape as ``values`` and must have the default array index data type.
40+
- fourth element must have the field name ``counts`` and must be an array containing the number of times each unique element occurs in ``x``. The order of the returned counts must match the order of ``values``, such that a specific element in ``counts`` corresponds to the respective unique element in ``values``. The returned array must have same shape as ``values`` and must have the default array index data type.
4141
4242
.. note::
4343
The order of unique elements is not specified and may vary between implementations.
@@ -78,8 +78,8 @@ def unique_counts(x: array, /) -> Tuple[array, array]:
7878
out: Tuple[array, array]
7979
a namedtuple `(values, counts)` whose
8080
81-
- first element must have the field name ``values`` and must be an array containing the unique elements of ``x``. The array must have the same data type as ``x``.
82-
- second element must have the field name `counts` and must be an array containing the number of times each unique element occurs in ``x``. The returned array must have same shape as ``values`` and must have the default array index data type.
81+
- first element must have the field name ``values`` and must be a one-dimensional array containing the unique elements of ``x``. The array must have the same data type as ``x``.
82+
- second element must have the field name `counts` and must be an array containing the number of times each unique element occurs in ``x``. The order of the returned counts must match the order of ``values``, such that a specific element in ``counts`` corresponds to the respective unique element in ``values``. The returned array must have same shape as ``values`` and must have the default array index data type.
8383
8484
.. note::
8585
The order of unique elements is not specified and may vary between implementations.
@@ -120,7 +120,7 @@ def unique_inverse(x: array, /) -> Tuple[array, array]:
120120
out: Tuple[array, array]
121121
a namedtuple ``(values, inverse_indices)`` whose
122122
123-
- first element must have the field name ``values`` and must be an array containing the unique elements of ``x``. The array must have the same data type as ``x``.
123+
- first element must have the field name ``values`` and must be a one-dimensional array containing the unique elements of ``x``. The array must have the same data type as ``x``.
124124
- second element must have the field name ``inverse_indices`` and must be an array containing the indices of ``values`` that reconstruct ``x``. The array must have the same shape as ``x`` and have the default array index data type.
125125
126126
.. note::
@@ -158,7 +158,7 @@ def unique_values(x: array, /) -> array:
158158
Returns
159159
-------
160160
out: array
161-
an array containing the set of unique elements in ``x``. The returned array must have the same data type as ``x``.
161+
a one-dimensional array containing the set of unique elements in ``x``. The returned array must have the same data type as ``x``.
162162
163163
.. note::
164164
The order of unique elements is not specified and may vary between implementations.

0 commit comments

Comments
 (0)