-
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
Add signbit
and fix argmin
and argmax
#20821
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20821 +/- ##
==========================================
+ Coverage 82.01% 82.03% +0.02%
==========================================
Files 559 559
Lines 52291 52367 +76
Branches 8084 8096 +12
==========================================
+ Hits 42884 42961 +77
+ Misses 7431 7428 -3
- Partials 1976 1978 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
We need to fix the version of torch until torch-xla supports a higher version. In this PR, the testing env is:
|
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.
LGTM, thank you for the contribution! Noted on torch version freezing.
keras/src/backend/jax/numpy.py
Outdated
@@ -15,6 +16,14 @@ | |||
from keras.src.backend.jax.core import convert_to_tensor | |||
|
|||
|
|||
def jax_uses_cpu(): |
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.
Please move this to keras/src/testing/test_case.py
. We can also have corresponding functions for other backends if needed.
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.
Sure! I have added uses_cpu()
to test_case.py
Based on this issue jax-ml/jax#24280, we should patch
argmin
andargmax
ops only when using the CPU due to the flush-to-zero (FTZ) issue.Since we need
signbit
to patch these ops, adding it is straightforward.