Delay attaching ShapeFeature to logprob rewrites#8274
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8274 +/- ##
=======================================
Coverage 91.42% 91.42%
=======================================
Files 124 124
Lines 19880 19881 +1
=======================================
+ Hits 18176 18177 +1
Misses 1704 1704
🚀 New features to boost your workflow:
|
458c346 to
bc6f899
Compare
jessegrabowski
approved these changes
May 1, 2026
jessegrabowski
left a comment
Member
There was a problem hiding this comment.
Does this depend on the larger ShapeFeature refactor?
Member
Author
No, that should only make this patch not needed |
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.
This temporarily fixes pymc-devs/pymc-extras#673
The underlying issue is ShapeFeature can leak old variables back in the graph, including RVs which PyMC is really afraid of seeing in a logprob graph (even if used only for shape)
The actual fix is happening in pymc-devs/pytensor#2056,
but ShapeFeature wasn't really buying us anything, and was actually slowing down logprob derivation. None of our rewrites relies on shape inference, and the comment concern goes back to the Aeppl time, where we didn't strictly split Model variables from arbitrary RVs. There should be no source of "confusion" these days.It still needed sometimes to lift shape away from RVs