Skip to content

Delay attaching ShapeFeature to logprob rewrites#8274

Merged
ricardoV94 merged 1 commit into
pymc-devs:mainfrom
ricardoV94:no_shape_feature_main
May 1, 2026
Merged

Delay attaching ShapeFeature to logprob rewrites#8274
ricardoV94 merged 1 commit into
pymc-devs:mainfrom
ricardoV94:no_shape_feature_main

Conversation

@ricardoV94

@ricardoV94 ricardoV94 commented May 1, 2026

Copy link
Copy Markdown
Member

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

@read-the-docs-community

read-the-docs-community Bot commented May 1, 2026

Copy link
Copy Markdown

@ricardoV94 ricardoV94 removed the request for review from juanitorduz May 1, 2026 13:21
@codecov

codecov Bot commented May 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.42%. Comparing base (1b071ca) to head (bc6f899).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8274   +/-   ##
=======================================
  Coverage   91.42%   91.42%           
=======================================
  Files         124      124           
  Lines       19880    19881    +1     
=======================================
+ Hits        18176    18177    +1     
  Misses       1704     1704           
Files with missing lines Coverage Δ
pymc/logprob/rewriting.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94 ricardoV94 force-pushed the no_shape_feature_main branch from 458c346 to bc6f899 Compare May 1, 2026 13:57
@ricardoV94 ricardoV94 changed the title Don't attach ShapeFeature to logprob rewrites Delay attaching ShapeFeature to logprob rewrites May 1, 2026

@jessegrabowski jessegrabowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this depend on the larger ShapeFeature refactor?

@ricardoV94

ricardoV94 commented May 1, 2026

Copy link
Copy Markdown
Member Author

Does this depend on the larger ShapeFeature refactor?

No, that should only make this patch not needed

@ricardoV94 ricardoV94 merged commit 1ad929c into pymc-devs:main May 1, 2026
42 checks passed
@ricardoV94 ricardoV94 deleted the no_shape_feature_main branch May 1, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants