-
Notifications
You must be signed in to change notification settings - Fork 145
Fix shape errors in scalar_solve_to_division
rewrite
#1516
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
Fix shape errors in scalar_solve_to_division
rewrite
#1516
Conversation
if core_op.b_ndim == 1: | ||
# Convert b to a column matrix | ||
b = b[..., None] |
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.
If a had shape (1, 1, 1) and b had shape (5, 1) and b_ndim=1 (meaning 5 is a batch dimension for b), we were returning something with the wrong shape as it became (1, 5, 1), after broadcasting with A, and then (1, 5) after squeezing below
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.
oops :D
I approved too quickly. Regarding the flipped signs, I need to look more closely. There might be sign ambiguity due to the squared square root, or there might be a bug. |
Tests are not passing so no accident of merging |
I think the problem might be the test. Numerical cholesky routines always compute such that the main diagonal is positive, which resolves any sign ambiguity in cho_solve. Here we're drawing the test value from a random normal, so there is sign ambiguity in the test. I think if you square a_val, at least in the cho_solve case, tests will pass. |
13d8124
to
e8a0b0b
Compare
Squaring worked like a charm |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1516 +/- ##
==========================================
+ Coverage 81.98% 82.03% +0.05%
==========================================
Files 231 231
Lines 52274 52350 +76
Branches 9206 9215 +9
==========================================
+ Hits 42856 42946 +90
+ Misses 7106 7095 -11
+ Partials 2312 2309 -3
🚀 New features to boost your workflow:
|
scalar_solve_to_division
scalar_solve_to_division
rewrite
This showed up in the PyMC tests. There were some mistakes with the alignment of a, b batch and core dimensions.
The tests are failing for CholeskySolve, it seems to come back with flipped signs. Is this expected?
📚 Documentation preview 📚: https://pytensor--1516.org.readthedocs.build/en/1516/