-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Remove reliance on __jax_array__
to unwrap variables.
#21702
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
base: master
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @hertschuh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an upcoming breaking change in JAX by removing the direct use of the deprecated Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request is a great initiative to remove the reliance on the deprecated __jax_array__
for unwrapping variables, aligning the codebase with future JAX releases. The changes are extensive, touching many files to make implicit conversions explicit, primarily by replacing standard Python operators with keras.ops
functions and explicitly unwrapping Variable
objects. This significantly improves code clarity and robustness.
I've identified a critical issue with some leftover debugging code that must be removed, and a high-severity bug in the implementation of the stack
function. Apart from these points, the changes look solid and consistent with the goal of the pull request.
# TODO UNDO | ||
import traceback | ||
|
||
print("### __jax_array__") | ||
traceback.print_stack() | ||
raise ValueError("__jax_array__") |
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.
This debugging code, including the TODO UNDO
comment, print
statements, and the ValueError
exception, should be removed before merging the pull request. It appears to have been added to trace usages of __jax_array__
but is not intended for the final version.
# TODO UNDO | |
import traceback | |
print("### __jax_array__") | |
traceback.print_stack() | |
raise ValueError("__jax_array__") | |
return self.value |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #21702 +/- ##
==========================================
- Coverage 82.59% 82.59% -0.01%
==========================================
Files 572 572
Lines 58314 58324 +10
Branches 9130 9130
==========================================
+ Hits 48166 48171 +5
- Misses 7817 7821 +4
- Partials 2331 2332 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Several months ago JAX deprecated passing __jax_array__-implementing objects directly, to, e.g., a jit-ted function. JAX has emitted a warning since that time. In a future release of JAX this will become a hard error.
53074e8
to
889d5bf
Compare
Several months ago JAX deprecated passing
__jax_array__
-implementing objects directly, to, e.g., ajit
-ted function. JAX has emitted a warning since that time. In a future release of JAX this will become a hard error.