Conversation
Summary of ChangesHello, 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 significantly enhances Keras's numerical operations by integrating a Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new unique operation to Keras's ops.numpy module, providing implementations for various backends (JAX, NumPy, TensorFlow, Torch) and marking it as not implemented for OpenVINO. The change also includes a new Unique operation class, comprehensive docstrings, and extensive unit tests. Feedback indicates a critical bug in the TensorFlow backend's lexicographical sort, which uses a Python for loop that will fail in graph mode; tf.linalg.lexsort is suggested as a fix. Additionally, compatibility issues with the sorted argument in older JAX and NumPy versions are noted, recommending its removal for broader support. Lastly, the input argument in keras.ops.unique should be renamed to x for API consistency.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22546 +/- ##
==========================================
+ Coverage 83.26% 83.30% +0.04%
==========================================
Files 596 596
Lines 67815 68172 +357
Branches 10558 10621 +63
==========================================
+ Hits 56463 56792 +329
- Misses 8608 8636 +28
Partials 2744 2744
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:
|
hertschuh
left a comment
There was a problem hiding this comment.
Thanks for working on this! I had actually started working on this a long time ago and didn't finish. I think you can reuse a lot of it though:
master...hertschuh:keras:unique_op
Some key comments:
- Please add the
return_indexargument. - Keep the
sortedargument (mine didn't have it) - I'd like to use the JAX signature, i.e. add the
sizeandfill_valuearguments. This is to make it compilable with JAX. Making it compilable makes it way more useful in general. The downside is that it adds complexity for the other backend as you need to pad the result (I have a working implementation for the NumPy backend).
Also please use the current pattern for unit tests instead of having a separate class.
If we only consider the parameters of the interface, Therefore, I recommend using torch.unique as the standard API. |
Ok, let's say we remove the I still want the |
Provide an implementation of
keras.ops.numpy.uniqueReferencing:
https://docs.jax.dev/en/latest/_autosummary/jax.numpy.unique.html
https://pytorch.org/docs/stable/generated/torch.unique.html
Include backends for TensorFlow, JAX, PyTorch, and NumPy.
However, do not include the OpenVINO backend for now.