Skip to content

Commit

Permalink
Merge pull request #81 from asmeurer/release
Browse files Browse the repository at this point in the history
1.4.1 release
  • Loading branch information
asmeurer authored Jan 20, 2024
2 parents 7ab1879 + ad2d852 commit 916a84b
Show file tree
Hide file tree
Showing 12 changed files with 210 additions and 125 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 1.4.1 (2024-01-18)

## Minor Changes

- Add support for the upcoming NumPy 2.0 release.

- Added a torch wrapper for `trace` (`torch.trace` doesn't support the
`offset` argument or stacking)

- Wrap numpy, cupy, and torch `nonzero` to raise an error for zero-dimensional
input arrays.

- Add torch wrapper for `newaxis`.

- Improve error message for `array_namespace`

- Fix linalg.cholesky returning the conjugate of the expected upper
decomposition for numpy and cupy.

# 1.4 (2023-09-13)

## Major Changes
Expand Down
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,54 @@ corresponding document does not yet exist for PyTorch, but you can examine the
various comments in the
[implementation](https://github.com/data-apis/array-api-compat/blob/main/array_api_compat/torch/_aliases.py)
to see what functions and behaviors have been wrapped.


## Releasing

To release, first note that CuPy must be tested manually (it isn't tested on
CI). Use the script

```
./test_cupy.sh
```

on a machine with a CUDA GPU.

Once you are ready to release, create a PR with a release branch, so that you
can verify that CI is passing. You must edit

```
array_api_compat/__init__.py
```

and update the version (the version is not computed from the tag because that
would break vendorability). You should also edit

```
CHANGELOG.md
```

with the changes for the release.

Then create a tag

```
git tag -a <version>
```

and push it to GitHub

```
git push origin <version>
```

Check that the `publish distributions` action works. Note that this action
will run even if the other CI fails, so you must make sure that CI is passing
*before* tagging.

This does mean you can ignore CI failures, but ideally you should fix any
failures or update the `*-xfails.txt` files before tagging, so that CI and the
cupy tests pass. Otherwise it will be hard to tell what things are breaking in
the future. It's also a good idea to remove any xpasses from those files (but
be aware that some xfails are from flaky failures, so unless you know the
underlying issue has been fixed, a xpass test is probably still xfail).
2 changes: 1 addition & 1 deletion array_api_compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
this implementation for the default when working with NumPy arrays.
"""
__version__ = '1.4'
__version__ = '1.4.1'

from .common import *
13 changes: 11 additions & 2 deletions array_api_compat/cupy/_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,17 @@
matmul = get_xp(cp)(_aliases.matmul)
matrix_transpose = get_xp(cp)(_aliases.matrix_transpose)
tensordot = get_xp(cp)(_aliases.tensordot)
vecdot = get_xp(cp)(_aliases.vecdot)
isdtype = get_xp(cp)(_aliases.isdtype)

# These functions are completely new here. If the library already has them
# (i.e., numpy 2.0), use the library version instead of our wrapper.
if hasattr(cp, 'vecdot'):
vecdot = cp.vecdot
else:
vecdot = get_xp(cp)(_aliases.vecdot)
if hasattr(cp, 'isdtype'):
isdtype = cp.isdtype
else:
isdtype = get_xp(cp)(_aliases.isdtype)

__all__ = _aliases.__all__ + ['asarray', 'asarray_cupy', 'bool', 'acos',
'acosh', 'asin', 'asinh', 'atan', 'atan2',
Expand Down
8 changes: 7 additions & 1 deletion array_api_compat/cupy/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@
pinv = get_xp(cp)(_linalg.pinv)
matrix_norm = get_xp(cp)(_linalg.matrix_norm)
svdvals = get_xp(cp)(_linalg.svdvals)
vector_norm = get_xp(cp)(_linalg.vector_norm)
diagonal = get_xp(cp)(_linalg.diagonal)
trace = get_xp(cp)(_linalg.trace)

# These functions are completely new here. If the library already has them
# (i.e., numpy 2.0), use the library version instead of our wrapper.
if hasattr(cp.linalg, 'vector_norm'):
vector_norm = cp.linalg.vector_norm
else:
vector_norm = get_xp(cp)(_linalg.vector_norm)

__all__ = linalg_all + _linalg.__all__

del get_xp
Expand Down
13 changes: 11 additions & 2 deletions array_api_compat/numpy/_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,17 @@
matmul = get_xp(np)(_aliases.matmul)
matrix_transpose = get_xp(np)(_aliases.matrix_transpose)
tensordot = get_xp(np)(_aliases.tensordot)
vecdot = get_xp(np)(_aliases.vecdot)
isdtype = get_xp(np)(_aliases.isdtype)

# These functions are completely new here. If the library already has them
# (i.e., numpy 2.0), use the library version instead of our wrapper.
if hasattr(np, 'vecdot'):
vecdot = np.vecdot
else:
vecdot = get_xp(np)(_aliases.vecdot)
if hasattr(np, 'isdtype'):
isdtype = np.isdtype
else:
isdtype = get_xp(np)(_aliases.isdtype)

__all__ = _aliases.__all__ + ['asarray', 'asarray_numpy', 'bool', 'acos',
'acosh', 'asin', 'asinh', 'atan', 'atan2',
Expand Down
8 changes: 7 additions & 1 deletion array_api_compat/numpy/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
pinv = get_xp(np)(_linalg.pinv)
matrix_norm = get_xp(np)(_linalg.matrix_norm)
svdvals = get_xp(np)(_linalg.svdvals)
vector_norm = get_xp(np)(_linalg.vector_norm)
diagonal = get_xp(np)(_linalg.diagonal)
trace = get_xp(np)(_linalg.trace)

# These functions are completely new here. If the library already has them
# (i.e., numpy 2.0), use the library version instead of our wrapper.
if hasattr(np.linalg, 'vector_norm'):
vector_norm = np.linalg.vector_norm
else:
vector_norm = get_xp(np)(_linalg.vector_norm)

__all__ = linalg_all + _linalg.__all__

del get_xp
Expand Down
Loading

0 comments on commit 916a84b

Please sign in to comment.