Skip to content

Commit cb44271

Browse files
authored
docs: add changelog for v2023.12 specification revision
PR-URL: data-apis#754 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 9d200ea commit cb44271

15 files changed

+298
-10
lines changed

CHANGELOG.md

+132
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,138 @@
44
55
This changelog is organized by specification version and notes all changes with respect to the previous version. Within the section for a specific version (e.g., v2022.12), separate sections are used for (a) changes to existing APIs and requirements, (b) new APIs and new requirements, and (c) errata.
66

7+
## v2023.12
8+
9+
### Updates
10+
11+
> Updates to existing APIs and requirements.
12+
13+
#### Normative
14+
15+
- Clarify expectations concerning exception handling ([gh-613](https://github.com/data-apis/array-api/pull/613))
16+
- Clarify that the constant `newaxis` is an alias of `None` ([gh-687](https://github.com/data-apis/array-api/pull/687))
17+
- Add design discussion on lazy versus eager implementations ([gh-708](https://github.com/data-apis/array-api/pull/708))
18+
- Revise guidance to require a minimum upper bound for supported ranks ([gh-702](https://github.com/data-apis/array-api/pull/702))
19+
- Relax design requirements for positional and keyword-only arguments ([gh-730](https://github.com/data-apis/array-api/pull/730))
20+
- Add recommendation to `__dlpack__` for handling read-only arrays ([gh-749](https://github.com/data-apis/array-api/pull/749))
21+
22+
#### APIs
23+
24+
- `__bool__`: allow lazy implementations to raise from intrinsically eager functions ([gh-652](https://github.com/data-apis/array-api/pull/652))
25+
- `__complex__`: allow lazy implementations to raise from intrinsically eager functions ([gh-652](https://github.com/data-apis/array-api/pull/652))
26+
- `__dlpack__`: add `max_version` keyword argument to support versioning ([gh-602](https://github.com/data-apis/array-api/pull/602))
27+
- `__dlpack__`: add `dl_device` and `copy` keyword arguments ([gh-741](https://github.com/data-apis/array-api/pull/741))
28+
- `__float__`: allow lazy implementations to raise from intrinsically eager functions ([gh-652](https://github.com/data-apis/array-api/pull/652))
29+
- `__index__`: allow lazy implementations to raise from intrinsically eager functions ([gh-652](https://github.com/data-apis/array-api/pull/652))
30+
- `__int__`: allow lazy implementations to raise from intrinsically eager functions ([gh-652](https://github.com/data-apis/array-api/pull/652))
31+
- `astype`: add support for an optional `device` keyword argument ([gh-665](https://github.com/data-apis/array-api/pull/665))
32+
- `from_dlpack`: require exceptions to address unsupported use cases ([gh-709](https://github.com/data-apis/array-api/pull/709))
33+
- `from_dlpack`: add support for `copy` and `device` keywords ([gh-741](https://github.com/data-apis/array-api/pull/741))
34+
- `max`: clarify that the order of signed zeros is unspecified ([gh-751](https://github.com/data-apis/array-api/pull/751))
35+
- `min`: clarify that the order of signed zeros is unspecified ([gh-751](https://github.com/data-apis/array-api/pull/751))
36+
- `take`: explicitly leave out-of-bounds behavior unspecified ([gh-701](https://github.com/data-apis/array-api/pull/701))
37+
- `tensordot`: allow negative axes ([gh-625](https://github.com/data-apis/array-api/pull/625))
38+
- `to_device`: clarify behavior when a provided `device` object corresponds to the same device on which an array instance resides ([gh-742](https://github.com/data-apis/array-api/pull/742))
39+
- `unique_all`: clarify the shape of the array containing unique values and the order of returned counts ([gh-752](https://github.com/data-apis/array-api/pull/752))
40+
- `unique_counts`: clarify the shape of the array containing unique values and the order of returned counts ([gh-752](https://github.com/data-apis/array-api/pull/752))
41+
- `unique_inverse`: clarify the shape of the array containing unique values ([gh-752](https://github.com/data-apis/array-api/pull/752))
42+
- `unique_values`: clarify the shape of the returned array ([gh-752](https://github.com/data-apis/array-api/pull/752))
43+
44+
#### Extensions
45+
46+
> Updates to APIs and requirements included as part of specification extensions.
47+
48+
- `fft.*`: clarify behavior of the `n` and `s` keyword arguments and the expected output array shape ([gh-720](https://github.com/data-apis/array-api/pull/720) and [gh-746](https://github.com/data-apis/array-api/pull/746); backported to v2022.12 revision of Array API specification)
49+
50+
* * *
51+
52+
### Additions
53+
54+
> New APIs and requirements added to the specification.
55+
56+
#### APIs
57+
58+
The following APIs were added to the specification:
59+
60+
- `__array_namespace_info__`: namespace with Array API namespace inspection utilities ([gh-689](https://github.com/data-apis/array-api/pull/689))
61+
- `clip`: clamp each element of an input array to a specified range ([gh-715](https://github.com/data-apis/array-api/pull/715))
62+
- `copysign`: compose a floating-point value with the magnitude of a `x1_i` and the sign of `x2_i` ([gh-693](https://github.com/data-apis/array-api/pull/693))
63+
- `cumulative_sum`: calculate the cumulative sum ([gh-653](https://github.com/data-apis/array-api/pull/653))
64+
- `hypot`: compute the square root of the sum of squares for each element in an array ([gh-703](https://github.com/data-apis/array-api/pull/703))
65+
- `maximum`: compute the maximum value for each element of an array relative to the respective element in another array ([gh-713](https://github.com/data-apis/array-api/pull/713))
66+
- `minimum`: compute the minimum value for each element of an array relative to the respective element in another array ([gh-713](https://github.com/data-apis/array-api/pull/713))
67+
- `moveaxis`: move array axes to new positions, while leaving other axes in their original positions ([gh-656](https://github.com/data-apis/array-api/pull/656))
68+
- `repeat`: repeat each element of an array a specified number of times ([gh-690](https://github.com/data-apis/array-api/pull/690))
69+
- `searchsorted`: find the indices into `x1` such that, if the corresponding elements in `x2` were inserted before the indices, the order of `x1`, when sorted in ascending order, would be preserved ([gh-699](https://github.com/data-apis/array-api/pull/699))
70+
- `signbit`: determine whether the sign bit is set for each element of an array ([gh-705](https://github.com/data-apis/array-api/pull/705))
71+
- `tile`: construct an array by tiling an input array ([gh-692](https://github.com/data-apis/array-api/pull/692))
72+
- `unstack`: split an array into a sequence of arrays along a given axis ([gh-604](https://github.com/data-apis/array-api/pull/604))
73+
74+
#### Inspection APIs
75+
76+
The following inspection APIs were added to the specification:
77+
78+
- `capabilities`: return a dictionary of array library capabilities ([gh-689](https://github.com/data-apis/array-api/pull/689))
79+
- `default_device`: return the default device ([gh-689](https://github.com/data-apis/array-api/pull/689))
80+
- `default_dtypes`: return a dictionary containing default data types ([gh-689](https://github.com/data-apis/array-api/pull/689))
81+
- `dtypes`: return a dictionary support Array API data types ([gh-689](https://github.com/data-apis/array-api/pull/689))
82+
- `devices`: return a list of supported devices ([gh-689](https://github.com/data-apis/array-api/pull/689))
83+
84+
* * *
85+
86+
### Breaking Changes
87+
88+
The following is a list of breaking changes relative to the previous version of the specification:
89+
90+
- `prod`: when provided a floating-point array, the function must return a floating-point array having the same data type ([gh-744](https://github.com/data-apis/array-api/pull/744))
91+
- `sum`: when provided a floating-point array, the function must return a floating-point array having the same data type ([gh-744](https://github.com/data-apis/array-api/pull/744))
92+
- `vecdot`: only allow a negative integer for the `axis` keyword argument ([gh-740](https://github.com/data-apis/array-api/pull/740))
93+
94+
#### Extensions
95+
96+
The following is a list of breaking changes in specification extensions relative to the previous version of the specification:
97+
98+
- `fft.fft`: require the input array to have a complex-valued floating-point data type and require that the output array have the same data type as the input array ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
99+
- `fft.fftn`: require the input array to have a complex-valued floating-point data type and require that the output array have the same data type as the input array ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
100+
- `fft.hfft`: require the input array to have a complex-valued floating-point data type and require that the output array have a real-valued data type having the same precision as the input array ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
101+
- `fft.ifft`: require the input array to have a complex-valued floating-point data type and require that the output array have the same data type as the input array ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
102+
- `fft.ifftn`: require the input array to have a complex-valued floating-point data type and require that the output array have the same data type as the input array ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
103+
- `fft.irfft`: require the output array have a real-valued floating-point data type having the same precision as the input array ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
104+
- `fft.irfftn`: require the output array have a real-valued floating-point data type having the same precision as the input array ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
105+
- `fft.fftfreq`: require the output array have the default real-valued floating-point data type ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
106+
- `fft.rfftfreq`: require the output array have the default real-valued floating-point data type ([gh-720](https://github.com/data-apis/array-api/pull/720); backported to v2022.12 revision of Array API specification)
107+
- `linalg.cross`: broadcast only along non-compute axes and only allow a negative integer for the `axis` keyword argument ([gh-740](https://github.com/data-apis/array-api/pull/740))
108+
- `linalg.trace`: when provided a floating-point array, the function must return a floating-point array having the same data type ([gh-744](https://github.com/data-apis/array-api/pull/744))
109+
110+
* * *
111+
112+
### Errata
113+
114+
The following is a list of fixes and points of clarification with regard to the previous version of the specification:
115+
116+
- `__getitem__`: clarify typing to allow `None` in indexing ([gh-674](https://github.com/data-apis/array-api/pull/674) and [gh-687](https://github.com/data-apis/array-api/pull/687))
117+
- `__ge__`: clarify that the operation is only defined for arrays having real-valued data types ([gh-736](https://github.com/data-apis/array-api/pull/736))
118+
- `__gt__`: clarify that the operation is only defined for arrays having real-valued data types ([gh-736](https://github.com/data-apis/array-api/pull/736))
119+
- `__le__`: clarify that the operation is only defined for arrays having real-valued data types ([gh-736](https://github.com/data-apis/array-api/pull/736))
120+
- `__lt__`: clarify that the operation is only defined for arrays having real-valued data types ([gh-736](https://github.com/data-apis/array-api/pull/736))
121+
- `abs`: fix typo in return value description ([gh-633](https://github.com/data-apis/array-api/pull/633))
122+
- `asarray`: fix typo in `device` keyword argument description ([gh-681](https://github.com/data-apis/array-api/pull/681))
123+
- `conj`: fix typo in parameter description ([gh-706](https://github.com/data-apis/array-api/pull/706))
124+
- `finfo_object`: fix missing `dtype` attribute ([gh-639](https://github.com/data-apis/array-api/pull/639))
125+
- `fft.*`: fix various typing issues ([gh-720](https://github.com/data-apis/array-api/pull/720))
126+
- `iinfo_object`: fix missing `dtype` attribute ([gh-639](https://github.com/data-apis/array-api/pull/639))
127+
- `linalg.qr`: fix typo in function description ([gh-661](https://github.com/data-apis/array-api/pull/661))
128+
- `linalg.cholesky`: fix typo in function description ([gh-677](https://github.com/data-apis/array-api/pull/677))
129+
- `linalg.svd`: fix return type ([gh-619](https://github.com/data-apis/array-api/pull/619))
130+
- `prod`: clarify type promotion behavior when `dtype=None` ([gh-666](https://github.com/data-apis/array-api/pull/666))
131+
- `sum`: clarify type promotion behavior when `dtype=None` ([gh-666](https://github.com/data-apis/array-api/pull/666))
132+
- `take`: fix typing for optional `axis` keyword argument ([gh-644](https://github.com/data-apis/array-api/pull/644))
133+
- `tensordot`: fix typo in parameter description ([gh-622](https://github.com/data-apis/array-api/pull/622))
134+
- `trace`: clarify type promotion behavior when `dtype=None` ([gh-666](https://github.com/data-apis/array-api/pull/666))
135+
- `vecdot`: fix definition of complex inner product ([gh-723](https://github.com/data-apis/array-api/pull/723))
136+
137+
* * *
138+
7139
## v2022.12
8140

9141
### Updates

src/array_api_stubs/_2022_12/indexing_functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def take(x: array, indices: array, /, *, axis: Optional[int] = None) -> array:
1414
input array.
1515
indices: array
1616
array indices. The array must be one-dimensional and have an integer data type.
17-
axis: int
17+
axis: Optional[int]
1818
axis over which to select values. If ``axis`` is negative, the function must determine the axis along which to select values by counting from the last dimension.
1919
2020
If ``x`` is a one-dimensional array, providing an ``axis`` is optional; however, if ``x`` has more than one dimension, providing an ``axis`` is required.

src/array_api_stubs/_draft/array_object.py

+23-2
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ def __bool__(self: array, /) -> bool:
247247
248248
.. versionchanged:: 2022.12
249249
Added boolean and complex data type support.
250+
251+
.. versionchanged:: 2023.12
252+
Allowed lazy implementations to error.
250253
"""
251254

252255
def __complex__(self: array, /) -> complex:
@@ -285,6 +288,9 @@ def __complex__(self: array, /) -> complex:
285288
The Python language requires the return value to be of type ``complex``. Lazy implementations are therefore not able to return any kind of lazy/delayed object here and should raise a ``ValueError`` instead.
286289
287290
.. versionadded:: 2022.12
291+
292+
.. versionchanged:: 2023.12
293+
Allowed lazy implementations to error.
288294
"""
289295

290296
def __dlpack__(
@@ -451,10 +457,13 @@ def __dlpack__(
451457
memory isn't modified).
452458
453459
.. versionchanged:: 2022.12
454-
Added BufferError.
460+
Added BufferError.
455461
456462
.. versionchanged:: 2023.12
457-
Added the ``max_version``, ``dl_device``, and ``copy`` keywords.
463+
Added the ``max_version``, ``dl_device``, and ``copy`` keywords.
464+
465+
.. versionchanged:: 2023.12
466+
Added recommendation for handling read-only arrays.
458467
"""
459468

460469
def __dlpack_device__(self: array, /) -> Tuple[Enum, int]:
@@ -539,6 +548,9 @@ def __float__(self: array, /) -> float:
539548
540549
.. versionchanged:: 2022.12
541550
Added boolean and complex data type support.
551+
552+
.. versionchanged:: 2023.12
553+
Allowed lazy implementations to error.
542554
"""
543555

544556
def __floordiv__(self: array, other: Union[int, float, array], /) -> array:
@@ -664,6 +676,9 @@ def __index__(self: array, /) -> int:
664676
**Lazy implementations**
665677
666678
The Python language requires the return value to be of type ``int``. Lazy implementations are therefore not able to return any kind of lazy/delayed object here and should raise a ``ValueError`` instead.
679+
680+
.. versionchanged:: 2023.12
681+
Allowed lazy implementations to error.
667682
"""
668683

669684
def __int__(self: array, /) -> int:
@@ -711,6 +726,9 @@ def __int__(self: array, /) -> int:
711726
712727
.. versionchanged:: 2022.12
713728
Added boolean and complex data type support.
729+
730+
.. versionchanged:: 2023.12
731+
Allowed lazy implementations to error.
714732
"""
715733

716734
def __invert__(self: array, /) -> array:
@@ -1192,6 +1210,9 @@ def to_device(
11921210
11931211
- When a provided ``device`` object corresponds to the same device on which an array instance resides, implementations may choose to perform an explicit copy or return ``self``.
11941212
- If ``stream`` is provided, the copy operation should be enqueued on the provided ``stream``; otherwise, the copy operation should be enqueued on the default stream/queue. Whether the copy is performed synchronously or asynchronously is implementation-dependent. Accordingly, if synchronization is required to guarantee data safety, this must be clearly explained in a conforming array library's documentation.
1213+
1214+
.. versionchanged:: 2023.12
1215+
Clarified behavior when a provided ``device`` object corresponds to the device on which an array instance resides.
11951216
"""
11961217

11971218

src/array_api_stubs/_draft/creation_functions.py

+3
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ def func(x, y):
289289
...
290290
291291
292+
.. versionchanged:: 2023.12
293+
Required exceptions to address unsupported use cases.
294+
292295
.. versionchanged:: 2023.12
293296
Added device and copy support.
294297
"""

src/array_api_stubs/_draft/data_type_functions.py

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def astype(
5757
5858
.. versionchanged:: 2022.12
5959
Added complex data type support.
60+
61+
.. versionchanged:: 2023.12
62+
Added device keyword argument support.
6063
"""
6164

6265

src/array_api_stubs/_draft/elementwise_functions.py

+12
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,8 @@ def clip(
806806
- If both ``min`` and ``max`` are ``None``, the elements of the returned array must equal the respective elements in ``x``.
807807
- If a broadcasted element in ``min`` is greater than a corresponding broadcasted element in ``max``, behavior is unspecified and thus implementation-dependent.
808808
- If ``x`` and either ``min`` or ``max`` have different data type kinds (e.g., integer versus floating-point), behavior is unspecified and thus implementation-dependent.
809+
810+
.. versionadded:: 2023.12
809811
"""
810812

811813

@@ -880,6 +882,8 @@ def copysign(x1: array, x2: array, /) -> array:
880882
- If ``x2_i`` is greater than ``0``, the result is ``NaN`` with a sign bit of ``0``.
881883
- If ``x2_i`` is ``NaN`` and the sign bit of ``x2_i`` is ``1``, the result is ``NaN`` with a sign bit of ``1``.
882884
- If ``x2_i`` is ``NaN`` and the sign bit of ``x2_i`` is ``0``, the result is ``NaN`` with a sign bit of ``0``.
885+
886+
.. versionadded:: 2023.12
883887
"""
884888

885889

@@ -1410,6 +1414,8 @@ def hypot(x1: array, x2: array, /) -> array:
14101414
IEEE 754-2019 requires support for subnormal (a.k.a., denormal) numbers, which are useful for supporting gradual underflow. However, hardware support for subnormal numbers is not universal, and many platforms (e.g., accelerators) and compilers support toggling denormals-are-zero (DAZ) and/or flush-to-zero (FTZ) behavior to increase performance and to guard against timing attacks.
14111415
14121416
Accordingly, conforming implementations may vary in their support for subnormal numbers.
1417+
1418+
.. versionadded:: 2023.12
14131419
"""
14141420

14151421

@@ -1929,6 +1935,8 @@ def maximum(x1: array, x2: array, /) -> array:
19291935
For floating-point operands,
19301936
19311937
- If either ``x1_i`` or ``x2_i`` is ``NaN``, the result is ``NaN``.
1938+
1939+
.. versionadded:: 2023.12
19321940
"""
19331941

19341942

@@ -1960,6 +1968,8 @@ def minimum(x1: array, x2: array, /) -> array:
19601968
For floating-point operands,
19611969
19621970
- If either ``x1_i`` or ``x2_i`` is ``NaN``, the result is ``NaN``.
1971+
1972+
.. versionadded:: 2023.12
19631973
"""
19641974

19651975

@@ -2390,6 +2400,8 @@ def signbit(x: array, /) -> array:
23902400
- If ``x_i`` is a negative (i.e., less than ``0``) finite number, the result is ``True``.
23912401
- If ``x_i`` is ``NaN`` and the sign bit of ``x_i`` is ``0``, the result is ``False``.
23922402
- If ``x_i`` is ``NaN`` and the sign bit of ``x_i`` is ``1``, the result is ``True``.
2403+
2404+
.. versionadded:: 2023.12
23932405
"""
23942406

23952407

0 commit comments

Comments
 (0)