Closed thomasjpfan closed 1 year ago
+1 for supporting older versions where possible. Probably back to all supported versions according to NEP 29 - so testing NumPy 1.21 would be useful. That may mean a few things don't work of course - a non-default value of the equal_nan
keyword here may just raise an exception I think.
The mean reason I hadn't tested older NumPy's is because we can't use NPY_PROMOTION_STATE=weak
, so a lot of tests fail with promotion issues. But I can try to create a longer xfails file for NumPy 1.21 and hopefully it will still catch issues like this one.
Well testing was a good idea because I found at least one other broken thing (np._CopyMode
in asarray
). Also, it looks like the docs for np.unique
are wrong. They say equal_nan
was introduced in NumPY 1.24 but it was introduced in 1.23.
Which cupy versions should we support?
So it turns out that equal_nan
isn't the only thing not supported in NumPy 1.21. Here are the things that won't work in NumPy 1.21:
unique_*
will not compare nans as unequal.finfo()
has no smallest_normal
.from_dlpack
or __dlpack__
.argmax()
and argmin()
do not have keepdims
.qr()
doesn't support matrix stacks.asarray()
doesn't support copy=True
(copy=False
is not supported even in the latest NumPy).NPY_PROMOTION_STATE=weak
to disable this).If any of these are an issue for you, I recommend bumping your minimum NumPy version, as I do not intend to work around them here (I suppose we could work around some of the simpler ones if it's really important).
The items listed in https://github.com/data-apis/array-api-compat/issues/21#issuecomment-1459038631 that do not work in NumPy 1.21 are not issues with scikit-learn's codebase.
We now support and test numpy 1.21.
Currently
unique_*
passesequal_nan
tonp.unique
, which was introduced in NumPy 1.24 (released 12/2022).https://github.com/data-apis/array-api-compat/blob/945609e64536a88d0f507d222140f97fa68776da/array_api_compat/common/_aliases.py#L184-L190
Does
array-api-compat
want to support older versions of NumPy?