Skip to content

fix: ensure raveled array uses float64 dtype in DictToArrayBijection (closes #8337)#8338

Draft
botbikamordehai2-sketch wants to merge 1 commit into
pymc-devs:mainfrom
botbikamordehai2-sketch:fix/issue-8337-1782139202
Draft

fix: ensure raveled array uses float64 dtype in DictToArrayBijection (closes #8337)#8338
botbikamordehai2-sketch wants to merge 1 commit into
pymc-devs:mainfrom
botbikamordehai2-sketch:fix/issue-8337-1782139202

Conversation

@botbikamordehai2-sketch

Copy link
Copy Markdown

What

When a PyMC model uses a length-one dimensioned vector RV as a non-sequence in pytensor.scan, the raveled NUTS setup fails because DictToArrayBijection.map does not enforce a consistent float64 dtype. The original code used np.concatenate on raveled arrays that may have incompatible dtypes (e.g., object from a 1-element vector), causing downstream errors.

Fix

Forced the raveled arrays to np.float64 before concatenation, and initialized the empty array with dtype=np.float64. This ensures the bijection always works with the expected numeric type.

Closes #8337

@github-actions github-actions Bot added the bug label Jun 22, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 pymc | 🛠️ Build #33251418 | 📁 Comparing a26c6ba against latest (94787c0)

  🔍 Preview build  

2 files changed
± glossary.html
± _modules/pymc/blocking.html

@ricardoV94

Copy link
Copy Markdown
Member

Users nay be trying to sample in float32 or all variables could be discrete. upcast dtype should be inferred from input types not forced

@ricardoV94

Copy link
Copy Markdown
Member

Also the issue explanation seems doubtful. Have you shown it?

@ricardoV94
ricardoV94 marked this pull request as draft July 7, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Raveled NUTS setup fails for scan model with length-one dimensioned vector RV

2 participants