Eagerly clean rv shape references introduced by maybe_resize#8302
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8302 +/- ##
==========================================
- Coverage 91.78% 91.77% -0.01%
==========================================
Files 125 125
Lines 20428 20437 +9
==========================================
+ Hits 18749 18757 +8
- Misses 1679 1680 +1
🚀 New features to boost your workflow:
|
Member
Author
|
@maresb can you check if this fixes the actual issue you had and not just the MWE? |
Contributor
|
Wow, thanks so much!!! Will check in the morning. |
44d6a1a to
5faa634
Compare
maresb
approved these changes
May 18, 2026
Contributor
maresb
left a comment
There was a problem hiding this comment.
Thanks so much @ricardoV94! Confirmed that this resolves also my non-minimal example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8301
Size arguments don't make it into regular logprob expressions, so we monkey patch that with
maybe_resizein #8105Otherwise it's fine for arguments to include shape(rv) in their arguments, PyTensor conditional_logprob will replace those with references to the shape(value) before the logprob function is invoked. TruncatedRV however can refer the shape of a variable that is not in the graph (the generating untruncated
dist) and introduce that in a way that conditional_logprob wouldn't clean.This PR is not the ultimate answer to this question. First the current check could be said to be too eager, RV in the graph just inside the
shapeargument are plausible fine. Or we could always try to callresolve_shapebefore failing. Still seems like a good place to do this for now, we can iterate later if it is not good enough.The new helpers have long been needed and reinvented in multiple places, so it's good to have them regardless.