[OpenVINO backend] Support for numpy.det using Faddeev-LeVerrier algorithm#22355
[OpenVINO backend] Support for numpy.det using Faddeev-LeVerrier algorithm#22355andersendsa wants to merge 2 commits intokeras-team:masterfrom
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 introduces the long-awaited implementation of the 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. Changelog
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.
Code Review
This pull request implements the numpy.det operation for the OpenVINO backend using the Faddeev-LeVerrier algorithm. The implementation appears to be correct, handling batch dimensions and including a workaround for an f64 bug. The corresponding correctness test is also enabled. I have one suggestion to improve code readability by consolidating constant definitions.
| minus_1 = ov_opset.constant([-1], Type.i32).output(0) | ||
| minus_2 = ov_opset.constant([-2], Type.i32).output(0) | ||
|
|
||
| N_node_1d = ov_opset.gather( | ||
| a_shape, minus_1, ov_opset.constant(0, Type.i32).output(0) | ||
| ).output(0) | ||
| N_node_scalar = ov_opset.squeeze( | ||
| N_node_1d, ov_opset.constant([0], Type.i32).output(0) | ||
| ).output(0) |
There was a problem hiding this comment.
To improve readability and maintainability, it's good practice to define constants at the top of their scope. Here, you can define zero_i32 and zero_i32_vec and reuse them. This avoids creating the same constant inline multiple times later in the function.
minus_1 = ov_opset.constant([-1], Type.i32).output(0)
minus_2 = ov_opset.constant([-2], Type.i32).output(0)
zero_i32 = ov_opset.constant(0, Type.i32).output(0)
zero_i32_vec = ov_opset.constant([0], Type.i32).output(0)
N_node_1d = ov_opset.gather(
a_shape, minus_1, zero_i32
).output(0)
N_node_scalar = ov_opset.squeeze(
N_node_1d, zero_i32_vec
).output(0)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22355 +/- ##
=======================================
Coverage 82.95% 82.96%
=======================================
Files 595 595
Lines 66040 66095 +55
Branches 10305 10308 +3
=======================================
+ Hits 54785 54836 +51
- Misses 8639 8640 +1
- Partials 2616 2619 +3
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:
|
|
hi @hertschuh this pr passes all the tests and is ready for review |
Details :
Implement numpy.det operation for the OpenVINO backend.
Closes issue : openvinotoolkit/openvino#34510