-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
check for original coords #5761
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
check for original coords #5761
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5761 +/- ##
==========================================
- Coverage 89.27% 89.25% -0.02%
==========================================
Files 74 74
Lines 13803 13808 +5
==========================================
+ Hits 12322 12325 +3
- Misses 1481 1483 +2
|
pymc/model.py
Outdated
actual=new_length, | ||
expected=old_length, | ||
) | ||
if original_coords is 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.
Add a comment to explain why this was needed, otherwise looks good
Is there a way to write a test for this to ensure whatever bug is being fixed is fixed? |
In light of #5751 we'll have to do this slightly different. Something like this:
The i) case happens with the example from #5760. The ii) case happens with something like this: with pm.Model():
a = pm.Normal("a", mu=[1,2,3], dims="fixed")
m = pm.MutableData("m", [[1,2,3]], dims=("one", "fixed"))
# This is fine because the "fixed" dim is not resized
pm.set_data({"m": [[1,2,3], [3,4,5]]})
# Can't work because the "fixed" dimension is linked to a constant shape:
# Note that the new data tries to change both dimensions
pm.set_data({"m": [[1,2], [3,4]]}) @TimOliverMaier you could make that change here, ideally with a test case. It is also relevant for #5751 and AFAIK @LukeLB is working on that at the moment. |
Thanks for the feedback I will look into this today. Also keeping an eye on #5751 |
I rearranged the if-statements a little to cluster those relevant for the |
I added a test only to assert that it is possible to set new data with identical dimensions. I think additional tests should wait until a possible merge with #5763. In |
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 is my quick fix for #5760 . When coords are set manually,
length_tensor
inset_data
has no owner. That's why it is crashing. In my fix I only check iforiginal_coords
is not None, meaning they were set explicitly (as far as I understand). However, I am pretty unsure if that's the way to go. Especially since there were a couple of issues in the last time conceringcoords
...