Skip to content

Fix useless unbatched Blockwise rewrite - #2420

Open
N-0-MAD wants to merge 1 commit into
pymc-devs:mainfrom
N-0-MAD:fix-useless-unbatched-blockwise
Open

N-0-MAD wants to merge 1 commit into
pymc-devs:mainfrom
N-0-MAD:fix-useless-unbatched-blockwise

Conversation

@N-0-MAD

@N-0-MAD N-0-MAD commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Description

This fixes an issue in local_useless_unbatched_blockwise where removing dummy batch dimensions could leave behind redundant Squeeze(ExpandDims(x)) expressions.

The rewrite now applies apply_local_dimshuffle_lift after squeezing the dummy dimensions, allowing these redundant dimension operations to be simplified before subsequent rewrites.

This prevents equivalent computations from being treated as distinct and allows common factorizations to be merged. A regression test was added demonstrating that equivalent Cholesky factorizations result in a single Cholesky node.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@N-0-MAD
N-0-MAD force-pushed the fix-useless-unbatched-blockwise branch from 740d702 to 87b9f4a Compare September 15, 2026 20:43
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.

local_useless_unbatched_blockwise emits squeeze(expand_dims(x)) that nothing collapses, so factorizations stop merging

1 participant