Skip to content

Abort local_block_diag_dot_to_dot_block_diag when n_inputs < 2#1865

Merged
jessegrabowski merged 1 commit intopymc-devs:mainfrom
jessegrabowski:blockdiag-rewrite-fix
Feb 5, 2026
Merged

Abort local_block_diag_dot_to_dot_block_diag when n_inputs < 2#1865
jessegrabowski merged 1 commit intopymc-devs:mainfrom
jessegrabowski:blockdiag-rewrite-fix

Conversation

@jessegrabowski
Copy link
Member

Closes #1864

@jessegrabowski jessegrabowski added bug Something isn't working graph rewriting linalg Linear algebra labels Jan 30, 2026
@jessegrabowski
Copy link
Member Author

is the change to pass through single inputs to block_diag a blocker for this PR?

@ricardoV94
Copy link
Member

Nothing I'm saying is a blocker. Just trying to discuss best practices to avoid this sort of failure in the future because it's not specific to this Op or rewrite.

@jessegrabowski
Copy link
Member Author

I added an eager return for the block_diag helper when n_inputs=1, and I also added a rewrite remove_useless_block_diag that kills any block diags with 1 input. That plus the n_inputs > 2 guard in the dot rewrite should put this issue to bed.

Copy link
Member

@ricardoV94 ricardoV94 left a comment

Choose a reason for hiding this comment

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

Love it. Do you want to add the regression test nevertheless or merge as is?

@jessegrabowski
Copy link
Member Author

I think no need, the regression test would be the kind of trivial test that I scold people for when their LLMs make them.

@jessegrabowski jessegrabowski merged commit f4196f9 into pymc-devs:main Feb 5, 2026
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working graph rewriting linalg Linear algebra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

local_block_diag_dot_to_dot_block_diag fails when BlockDiag Op has 1 input

2 participants