-
Notifications
You must be signed in to change notification settings - Fork 117
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
added erf op to math.py #908
Closed
Closed
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6485433
added erf op to math.py
sqali 61c9690
code reformatting done, introduced erf function in jax, torch and numpy
sqali 7960106
shortened comment lines, renamed the new function
sqali d9f99f2
added decorator above the erf function, added tests under the existin…
sqali ef05f70
Merge branch 'keras-team:main' into main
sqali 8d4b8eb
changes done to erf functions as per suggestion
sqali e829832
Merge branch 'keras-team:main' into main
sqali 686f339
Merge branch 'keras-team:main' into main
sqali 6b52b8a
backend.math added to erf function, fenced code block used fo
sqali 7f76459
code reformatting applied
sqali 5efabf5
corrected jax expression, numpy function
sqali ebe06c3
Merge branch 'keras-team:main' into main
sqali 3f199c3
Update math_test.py
sqali 0307b74
Update math_test.py
sqali File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,3 +248,7 @@ def istft( | |
|
||
def rsqrt(x): | ||
return jax.lax.rsqrt(x) | ||
|
||
|
||
def erf(x): | ||
return jax.lax.erf(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,3 +302,7 @@ def istft( | |
|
||
def rsqrt(x): | ||
return 1.0 / np.sqrt(x) | ||
|
||
|
||
def erf(x): | ||
return np.array(scipy.special.erf(x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,3 +239,7 @@ def istft( | |
|
||
def rsqrt(x): | ||
return tf.math.rsqrt(x) | ||
|
||
|
||
def erf(x): | ||
return tf.math.erf(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Your test values are too large. Try 1e5. This the source of the large discrepancy IMO.
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 implemented the changes, but I can see from the tests that it is failing for the below array examples. I wonder if there is anything wrong in the implementation function itself.