Skip to content
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

Promote isclose arguments to inexact dtype (fixes #19935). #19936

Merged
merged 1 commit into from
Feb 23, 2024

Conversation

tillahoffmann
Copy link
Contributor

It turns out that #19935 is easily fixed by promoting to inexact dtypes. This ensures np.isclose(6, 10, rtol=0.5) and jnp.isclose(6, 10, rtol=0.5) give the same result.

Copy link
Collaborator

@jakevdp jakevdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@google-ml-butler google-ml-butler bot added kokoro:force-run pull ready Ready for copybara import and testing labels Feb 22, 2024
@jakevdp jakevdp self-assigned this Feb 22, 2024
@jakevdp
Copy link
Collaborator

jakevdp commented Feb 23, 2024

This is causing some downstream test failures for isclose called on key types:

import jax
key = jax.random.key(0)
jax.numpy.isclose(key, key)

We should probably fall back to equality checks when the following is true dtypes.issubdtype(dtype, dtypes.extended).

Copy link
Collaborator

@jakevdp jakevdp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Last thing - could you squash your changes into a single commit please? See https://jax.readthedocs.io/en/latest/contributing.html#single-change-commits-and-pull-requests

@copybara-service copybara-service bot merged commit ae9d677 into jax-ml:main Feb 23, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull ready Ready for copybara import and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants