-
Notifications
You must be signed in to change notification settings - Fork 136
Use lapack func instead of scipy.linalg.cholesky
#1487
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
Conversation
* Now skips 2D checks in perform * Updated the default arguments for `check_finite` to false to match documentation * Add benchmark test case
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.
Nice start, left some comments
Thank you for the feedback. I moved it all to |
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.
Looking really great! I see a few more places we can improve the performance (avoiding copy + cleaning up the code) then I think it'll be ready to merge
Looks really nice! I triggered a CI run, waiting to see if tests pass then will approve, pending thumbs up from @ricardoV94 |
You have a test failure in
Could be related to the change in the default |
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.
Looks good. small comment
pytensor/tensor/slinalg.py
Outdated
|
||
if self.check_finite and not np.isfinite(x).all(): | ||
if self.on_error == "nan": | ||
out[0] = np.full(x.shape, np.nan, dtype=node.outputs[0].type.dtype) |
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.
out[0] = np.full(x.shape, np.nan, dtype=node.outputs[0].type.dtype) | |
out[0] = np.full(x.shape, np.nan, dtype=potrf.dtype) |
It is fixed now. I had been skipping the
|
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (70.37%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1487 +/- ##
=======================================
Coverage ? 81.98%
=======================================
Files ? 231
Lines ? 52192
Branches ? 9185
=======================================
Hits ? 42790
Misses ? 7094
Partials ? 2308
🚀 New features to boost your workflow:
|
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.
Looks great, thanks for this!
check_finite
to false to match documentationDescription
Adds
_cholesky
method toslinalg.Cholesky
to replace thescipy.linalg.cholesky
wrapper. It is almost identical to the corresponding scipy function but it skips the 2d check and the batching wrapper.Previous performance (with
check_finite=False
):After changes:
Related Issue
Checklist
Type of change
📚 Documentation preview 📚: https://pytensor--1487.org.readthedocs.build/en/1487/