-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix compute_test_value error when creating observed variables #6982
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
…ed RV in model creation (Fix pymc-devs#6981) - Issue: pymc-devs#6981 - This fix only affects cases with `pytensor.config.compute_test_value!="off"`. Code is not executed otherwise.
|
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.
Thanks for opening a PR.
This is related to some functionality that is not much needed in PyMC anymore and we may remove this PyTensor flag in the near future. Anyway, I've left some comments below
Should always have the right shape when not None
…e as observed data
There are no cases where the `test_value` should be None, so the code inside that block should not ever be used.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6982 +/- ##
==========================================
+ Coverage 91.70% 92.10% +0.40%
==========================================
Files 100 100
Lines 16899 16894 -5
==========================================
+ Hits 15497 15560 +63
+ Misses 1402 1334 -68
|
pytensor.config.compute_test_value != off
I pushed a commit that simplifies the test, after confirming it still failed in the main branch. Thanks for the PR. This is the best kind of bug fix :D |
What is this PR about?
This fixes #6981. The issue was about observed variables causing a
TypeError
when a model is created withpytensor.config.compute_test_value != "off"
It adds a small test that reproduces the issue and replacesrv_var.shape
byrv_var.type.shape
in thenp.broadcast_to()
call.Let me know if I should move the test elsewhere or if something else is needed!
Thanks!
Checklist
Bugfixes
TypeError: Variables do not support boolean operations
withcompute_test_value = "raise"
for observed random variable #6981.📚 Documentation preview 📚: https://pymc--6982.org.readthedocs.build/en/6982/