Skip to content

Commit 916a84b

Browse files
authoredJan 20, 2024
Merge pull request #81 from asmeurer/release
1.4.1 release
·
1.121.5
2 parents 7ab1879 + ad2d852 commit 916a84b

File tree

12 files changed

+210
-125
lines changed

12 files changed

+210
-125
lines changed
 

‎CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# 1.4.1 (2024-01-18)
2+
3+
## Minor Changes
4+
5+
- Add support for the upcoming NumPy 2.0 release.
6+
7+
- Added a torch wrapper for `trace` (`torch.trace` doesn't support the
8+
`offset` argument or stacking)
9+
10+
- Wrap numpy, cupy, and torch `nonzero` to raise an error for zero-dimensional
11+
input arrays.
12+
13+
- Add torch wrapper for `newaxis`.
14+
15+
- Improve error message for `array_namespace`
16+
17+
- Fix linalg.cholesky returning the conjugate of the expected upper
18+
decomposition for numpy and cupy.
19+
120
# 1.4 (2023-09-13)
221

322
## Major Changes

‎README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,54 @@ corresponding document does not yet exist for PyTorch, but you can examine the
300300
various comments in the
301301
[implementation](https://github.com/data-apis/array-api-compat/blob/main/array_api_compat/torch/_aliases.py)
302302
to see what functions and behaviors have been wrapped.
303+
304+
305+
## Releasing
306+
307+
To release, first note that CuPy must be tested manually (it isn't tested on
308+
CI). Use the script
309+
310+
```
311+
./test_cupy.sh
312+
```
313+
314+
on a machine with a CUDA GPU.
315+
316+
Once you are ready to release, create a PR with a release branch, so that you
317+
can verify that CI is passing. You must edit
318+
319+
```
320+
array_api_compat/__init__.py
321+
```
322+
323+
and update the version (the version is not computed from the tag because that
324+
would break vendorability). You should also edit
325+
326+
```
327+
CHANGELOG.md
328+
```
329+
330+
with the changes for the release.
331+
332+
Then create a tag
333+
334+
```
335+
git tag -a <version>
336+
```
337+
338+
and push it to GitHub
339+
340+
```
341+
git push origin <version>
342+
```
343+
344+
Check that the `publish distributions` action works. Note that this action
345+
will run even if the other CI fails, so you must make sure that CI is passing
346+
*before* tagging.
347+
348+
This does mean you can ignore CI failures, but ideally you should fix any
349+
failures or update the `*-xfails.txt` files before tagging, so that CI and the
350+
cupy tests pass. Otherwise it will be hard to tell what things are breaking in
351+
the future. It's also a good idea to remove any xpasses from those files (but
352+
be aware that some xfails are from flaky failures, so unless you know the
353+
underlying issue has been fixed, a xpass test is probably still xfail).

‎array_api_compat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
this implementation for the default when working with NumPy arrays.
1818
1919
"""
20-
__version__ = '1.4'
20+
__version__ = '1.4.1'
2121

2222
from .common import *

‎array_api_compat/cupy/_aliases.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,17 @@
6161
matmul = get_xp(cp)(_aliases.matmul)
6262
matrix_transpose = get_xp(cp)(_aliases.matrix_transpose)
6363
tensordot = get_xp(cp)(_aliases.tensordot)
64-
vecdot = get_xp(cp)(_aliases.vecdot)
65-
isdtype = get_xp(cp)(_aliases.isdtype)
64+
65+
# These functions are completely new here. If the library already has them
66+
# (i.e., numpy 2.0), use the library version instead of our wrapper.
67+
if hasattr(cp, 'vecdot'):
68+
vecdot = cp.vecdot
69+
else:
70+
vecdot = get_xp(cp)(_aliases.vecdot)
71+
if hasattr(cp, 'isdtype'):
72+
isdtype = cp.isdtype
73+
else:
74+
isdtype = get_xp(cp)(_aliases.isdtype)
6675

6776
__all__ = _aliases.__all__ + ['asarray', 'asarray_cupy', 'bool', 'acos',
6877
'acosh', 'asin', 'asinh', 'atan', 'atan2',

‎array_api_compat/cupy/linalg.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@
2929
pinv = get_xp(cp)(_linalg.pinv)
3030
matrix_norm = get_xp(cp)(_linalg.matrix_norm)
3131
svdvals = get_xp(cp)(_linalg.svdvals)
32-
vector_norm = get_xp(cp)(_linalg.vector_norm)
3332
diagonal = get_xp(cp)(_linalg.diagonal)
3433
trace = get_xp(cp)(_linalg.trace)
3534

35+
# These functions are completely new here. If the library already has them
36+
# (i.e., numpy 2.0), use the library version instead of our wrapper.
37+
if hasattr(cp.linalg, 'vector_norm'):
38+
vector_norm = cp.linalg.vector_norm
39+
else:
40+
vector_norm = get_xp(cp)(_linalg.vector_norm)
41+
3642
__all__ = linalg_all + _linalg.__all__
3743

3844
del get_xp

‎array_api_compat/numpy/_aliases.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,17 @@
6161
matmul = get_xp(np)(_aliases.matmul)
6262
matrix_transpose = get_xp(np)(_aliases.matrix_transpose)
6363
tensordot = get_xp(np)(_aliases.tensordot)
64-
vecdot = get_xp(np)(_aliases.vecdot)
65-
isdtype = get_xp(np)(_aliases.isdtype)
64+
65+
# These functions are completely new here. If the library already has them
66+
# (i.e., numpy 2.0), use the library version instead of our wrapper.
67+
if hasattr(np, 'vecdot'):
68+
vecdot = np.vecdot
69+
else:
70+
vecdot = get_xp(np)(_aliases.vecdot)
71+
if hasattr(np, 'isdtype'):
72+
isdtype = np.isdtype
73+
else:
74+
isdtype = get_xp(np)(_aliases.isdtype)
6675

6776
__all__ = _aliases.__all__ + ['asarray', 'asarray_numpy', 'bool', 'acos',
6877
'acosh', 'asin', 'asinh', 'atan', 'atan2',

‎array_api_compat/numpy/linalg.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@
2222
pinv = get_xp(np)(_linalg.pinv)
2323
matrix_norm = get_xp(np)(_linalg.matrix_norm)
2424
svdvals = get_xp(np)(_linalg.svdvals)
25-
vector_norm = get_xp(np)(_linalg.vector_norm)
2625
diagonal = get_xp(np)(_linalg.diagonal)
2726
trace = get_xp(np)(_linalg.trace)
2827

28+
# These functions are completely new here. If the library already has them
29+
# (i.e., numpy 2.0), use the library version instead of our wrapper.
30+
if hasattr(np.linalg, 'vector_norm'):
31+
vector_norm = np.linalg.vector_norm
32+
else:
33+
vector_norm = get_xp(np)(_linalg.vector_norm)
34+
2935
__all__ = linalg_all + _linalg.__all__
3036

3137
del get_xp

‎cupy-xfails.txt

Lines changed: 90 additions & 93 deletions
Large diffs are not rendered by default.

‎numpy-1-21-xfails.txt

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,18 @@ array_api_tests/test_special_cases.py::test_iop[__ipow__(x1_i is -infinity and x
5050
array_api_tests/test_special_cases.py::test_iop[__ipow__(x1_i is -0 and x2_i > 0 and not (x2_i.is_integer() and x2_i % 2 == 1)) -> +0]
5151
array_api_tests/meta/test_hypothesis_helpers.py::test_symmetric_matrices
5252

53-
# testsuite issue with test_square
54-
# https://github.com/data-apis/array-api-tests/issues/190
55-
array_api_tests/test_operators_and_elementwise_functions.py::test_square
53+
# fft functions are not yet supported
54+
# (https://github.com/data-apis/array-api-compat/issues/67)
55+
array_api_tests/test_fft.py::test_fft
56+
array_api_tests/test_fft.py::test_ifft
57+
array_api_tests/test_fft.py::test_fftn
58+
array_api_tests/test_fft.py::test_ifftn
59+
array_api_tests/test_fft.py::test_rfft
60+
array_api_tests/test_fft.py::test_irfft
61+
array_api_tests/test_fft.py::test_rfftn
62+
array_api_tests/test_fft.py::test_irfftn
63+
array_api_tests/test_fft.py::test_hfft
64+
array_api_tests/test_fft.py::test_ihfft
5665

5766
# NumPy 1.21 specific XFAILS
5867
############################
@@ -236,16 +245,3 @@ array_api_tests/test_special_cases.py::test_binary[remainder(x1_i is +0 and x2_i
236245
array_api_tests/test_special_cases.py::test_binary[remainder(x1_i is -0 and x2_i < 0) -> -0]
237246
array_api_tests/test_special_cases.py::test_binary[remainder(x1_i is -0 and x2_i > 0) -> +0]
238247
array_api_tests/test_special_cases.py::test_iop[__iadd__(x1_i is -0 and x2_i is -0) -> -0]
239-
240-
# fft functions are not yet supported
241-
# (https://github.com/data-apis/array-api-compat/issues/67)
242-
array_api_tests/test_fft.py::test_fft
243-
array_api_tests/test_fft.py::test_ifft
244-
array_api_tests/test_fft.py::test_fftn
245-
array_api_tests/test_fft.py::test_ifftn
246-
array_api_tests/test_fft.py::test_rfft
247-
array_api_tests/test_fft.py::test_irfft
248-
array_api_tests/test_fft.py::test_rfftn
249-
array_api_tests/test_fft.py::test_irfftn
250-
array_api_tests/test_fft.py::test_hfft
251-
array_api_tests/test_fft.py::test_ihfft

‎numpy-xfails.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(x1_i is -infinity
4040
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(isfinite(x1_i) and x1_i > 0 and x2_i is -infinity) -> -0]
4141
array_api_tests/test_special_cases.py::test_iop[__ifloordiv__(isfinite(x1_i) and x1_i < 0 and x2_i is +infinity) -> -0]
4242

43-
# testsuite issue with test_square
44-
# https://github.com/data-apis/array-api-tests/issues/190
45-
array_api_tests/test_operators_and_elementwise_functions.py::test_square
46-
4743
# https://github.com/numpy/numpy/issues/21213
4844
array_api_tests/test_special_cases.py::test_binary[__pow__(x1_i is -infinity and x2_i > 0 and not (x2_i.is_integer() and x2_i % 2 == 1)) -> +infinity]
4945
array_api_tests/test_special_cases.py::test_binary[__pow__(x1_i is -0 and x2_i > 0 and not (x2_i.is_integer() and x2_i % 2 == 1)) -> +0]

‎test_cupy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ tmpdir=$(mktemp -d)
1212
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
1313
export PYTHONPATH=$SCRIPT_DIR
1414

15-
PYTEST_ARGS="--max-examples 200 -v -rxXfE --ci"
15+
PYTEST_ARGS="--max-examples 200 -v -rxXfE --ci --hypothesis-disable-deadline"
1616

1717
cd $tmpdir
1818
git clone https://github.com/data-apis/array-api-tests

‎torch-xfails.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ array_api_tests/test_special_cases.py::test_iop[__imod__(x1_i is +0 and x2_i < 0
171171
array_api_tests/test_special_cases.py::test_iop[__imod__(x1_i is -0 and x2_i > 0) -> +0]
172172
array_api_tests/test_special_cases.py::test_unary[sign(x_i is NaN) -> NaN]
173173

174-
# testsuite issue with test_square
175-
# https://github.com/data-apis/array-api-tests/issues/190
176-
array_api_tests/test_operators_and_elementwise_functions.py::test_square
177-
178174
# Float correction is not supported by pytorch
179175
# (https://github.com/data-apis/array-api-tests/issues/168)
180176
array_api_tests/test_special_cases.py::test_empty_arrays[std]

0 commit comments

Comments
 (0)
Please sign in to comment.