Skip to content

fix: Handle scalar inputs in JoinDims.perform (closes #2197)#2205

Closed
botbikamordehai2-sketch wants to merge 1 commit into
pymc-devs:mainfrom
botbikamordehai2-sketch:fix/issue-2197-1781006777
Closed

fix: Handle scalar inputs in JoinDims.perform (closes #2197)#2205
botbikamordehai2-sketch wants to merge 1 commit into
pymc-devs:mainfrom
botbikamordehai2-sketch:fix/issue-2197-1781006777

Conversation

@botbikamordehai2-sketch

Copy link
Copy Markdown

What

The JoinDims operation with n_axes=0 (inserting a new dimension of size 1) or when joining axes that result in a size-1 dimension from a scalar (shape ()) input causes a ValueError in the numba backend's vectorize shape check. This occurs because the numpy reshape with -1 on a scalar array produces a shape (1,) array, but the numba vectorize codegen in 3.0.4 strictly validates that the runtime shape matches the declared shape.

Fix

Add a special case in JoinDims.perform when n_axes=0: use np.expand_dims instead of reshape. This correctly handles scalar inputs and produces an array of shape (1,) without triggering the strict vectorize shape validation. For cases where n_axes>0, the existing reshape logic works correctly because the input is guaranteed to have at least start_axis + n_axes dimensions (validated in make_node).

Closes #2197

@ricardoV94

ricardoV94 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Vibe fix that misses the point and doesn't fix anything. Problem is fixed by #2203

@ricardoV94 ricardoV94 closed this Jun 9, 2026
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.

BUG: numba backend Blockwise.Vectorize shape check regression in 3.0.4 for Join with shape (1,) declared inputs that are scalar at runtime

2 participants