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

Adding erf function #18476

Merged
merged 4 commits into from
Sep 23, 2023
Merged

Adding erf function #18476

merged 4 commits into from
Sep 23, 2023

Conversation

sqali
Copy link
Contributor

@sqali sqali commented Sep 22, 2023

Hi,

This pull request (clone of PR ) is raised to add the ERF function implementation along with support for various backends.

Thanks & Regards

Copy link
Member

@fchollet fchollet left a 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.

[-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
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Implemented it but still the checks are failing. Kindly let me know if you want me to do some extra checks, so I can rigorously test and find the reasons behind these failures. The difference seems to be the same as in the previous repository (keras-core) errors.

image

sqali and others added 2 commits September 23, 2023 10:26
@keras_export("keras_core.ops.erf") corrected to @keras_export("keras.ops.erf")
Copy link
Member

@fchollet fchollet left a 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.

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Sep 23, 2023
@fchollet fchollet merged commit 7fe6672 into keras-team:master Sep 23, 2023
2 of 6 checks passed
@google-ml-butler google-ml-butler bot removed ready to pull Ready to be merged into the codebase kokoro:force-run labels Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants