-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Adding erf function #18476
Adding erf function #18476
Conversation
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 ran some checks, and while there are minor differences between backends (torch is especially divergent, as is often the case), they should stay below 1e-5. Just use scipy.special.erf(x)
as the reference.
keras/ops/math_test.py
Outdated
[-3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0], dtype=dtype | ||
) | ||
expected_output = (2 / np.sqrt(np.pi)) * np.vectorize(math.erf)( | ||
sample_values |
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.
You can just use scipy.special.erf(x)
as the reference.
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.
@keras_export("keras_core.ops.erf") corrected to @keras_export("keras.ops.erf")
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.
Thanks for the contribution! I'll just take it over.
Hi,
This pull request (clone of PR ) is raised to add the ERF function implementation along with support for various backends.
Thanks & Regards