-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_finfo fails on numpy #317
Comments
JAX explicitly disables this test: https://github.com/jax-ml/jax/blob/40fc6598f96999271a3c19cfaab6f02579c003d6/tests/array_api_skips.txt#L3-L4 We've followed NumPy here and are waiting for a resolution of the above issue. |
There should not be a need to work around this, that's probably counterproductive. NumPy scalars duck type with
I re-read this issue quickly; it seems like all we need is a doc update in the standard that says "duck typing is allowed", and then making this test a bit more flexible perhaps (not sure, also okay to keep the skips). The current state in NumPy and JAX should be fine. @ev-br the NumPy skip list is maintained at https://github.com/numpy/numpy/blob/fc7cc1ec4988ce8b73766434930c9df2661ada59/tools/ci/array-api-xfails.txt#L2, so those are the known incompatibilities - a mix of limitations in the test suite and a few missing things still to be implemented in NumPy. |
Not sure how that would help. f32 is not related to python float
Keeping the skips + closing this issue as a wontfix is probably the way to go indeed, unless NumPy implements the change (which I think makes sense, but it's up to NumPy). |
Yes, we agreed a while ago that duck-typed floats should be OK, but the tests were never updated. |
FWIW, as an user of finfo, I have found that duck-typing of finfo instance attributes is a very useful feature. |
@pearu can you clarify what you mean? |
I think in 99% of cases, the duck typing you need is that it works with Python operators and is accepted by NumPy functions that accept |
Yes. With earlier versions of numpy, I had to use |
You seem to be agreeing with the point I made at data-apis/array-api#405 that the return types for finfo should not be |
Yes, except |
The spec seems to imply that
xp.finfo(xp.float32).eps
is a python float, but numpy and jax.numpy use numpy scalars insteadNot hard to work around on the -compat level, even if having a wrapper for finfo feels a bit cheesy.
The text was updated successfully, but these errors were encountered: