-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
better log10 doc #22192
base: main
Are you sure you want to change the base?
better log10 doc #22192
Conversation
jax/_src/numpy/ufuncs.py
Outdated
Examples: | ||
>>> x1 = jnp.array([0.01, 0.1, 1, 10, 100, 1000]) | ||
>>> jnp.log10(x1) | ||
Array([-1.9999999 , -0.99999994, 0. , 0.99999994, 1.9999999 , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Floating point outputs like this are problematic for doctests, because different backends may round results differently. One way to deal with this is to print the values within a jnp.printoptions
context; you can check out some examples in jax/_src/numpy.lax_numpy.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have requested a small change. After you remove that example, can you squash into a single commit? Then we can merge. Thanks!
jax/_src/numpy/ufuncs.py
Outdated
>>> x2 = jnp.array([-0.01, -0.1, -1, -10, -100, -1000]) | ||
>>> jnp.log10(x2) | ||
Array([nan, nan, nan, nan, nan, nan], dtype=float32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like in #22191, I think we should skip this example with negative numbers.
removing complex example forced precision context to work better with doctests removing negative example
df18677
to
13f2587
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - thanks!
@pkgoogle — It looks like the merge of this one collided with the log2 PR. Would you mind rebasing your branch onto the current jax |
better log10 doc
Part of #21461