Skip to content

Conversation

@eclipse1605
Copy link
Contributor

Description

in #8036, a multi output IfElse was being rewritten into separate single output ifelses, which:

  • breaks cross output dependencies within a branch (e.g. output 2 depending on output 1), and
  • can trigger runtime shape assertions (SpecifyShape) from the dead branch when execution is non lazy.

i tried to fix it by:

  • handle it jointly as a measurable IfElse. computing per output logps per branch while substituting cross output dependencies with the corresponding value variables (so each output’s logp can be derived in a measurable IR).
  • make logprob evaluation robust to non lazy backends by using "branch safe" value variables: the selected branch stays strict, while the non selected branch uses a shape coerced value to prevent dead branch shape assertions from crashing.
  • remove SpecifyShape nodes during logprob IR cleanup, since they only add runtime assertions and can cause dead branch failures under non lazy evaluation.
  • keep transform measurability detection from incorrectly treating deterministic wrappers as extra "sources of measurability" unless they contain RandomVariable ancestry, which is needed to keep the new IfElse logprob path measurable.

Related Issue

@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

❌ Patch coverage is 90.14085% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.69%. Comparing base (c68c56e) to head (a7a853f).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
pymc/logprob/mixture.py 87.50% 7 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8070      +/-   ##
==========================================
- Coverage   91.42%   90.69%   -0.74%     
==========================================
  Files         117      121       +4     
  Lines       19154    19521     +367     
==========================================
+ Hits        17512    17704     +192     
- Misses       1642     1817     +175     
Files with missing lines Coverage Δ
pymc/logprob/rewriting.py 100.00% <100.00%> (ø)
pymc/logprob/transforms.py 95.91% <100.00%> (+0.27%) ⬆️
pymc/logprob/mixture.py 85.90% <87.50%> (-9.83%) ⬇️

... and 14 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant