Scalar Resolution with Regression Test#8103
Open
AdishreeB wants to merge 4 commits intopymc-devs:mainfrom
Open
Scalar Resolution with Regression Test#8103AdishreeB wants to merge 4 commits intopymc-devs:mainfrom
AdishreeB wants to merge 4 commits intopymc-devs:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8103 +/- ##
==========================================
- Coverage 88.76% 86.92% -1.84%
==========================================
Files 116 123 +7
Lines 18971 19525 +554
==========================================
+ Hits 16840 16973 +133
- Misses 2131 2552 +421
🚀 New features to boost your workflow:
|
ricardoV94
reviewed
Feb 11, 2026
| pm.Normal("x", 0, 1) | ||
|
|
||
| try: | ||
| model.debug(fn="dlogp") |
Member
There was a problem hiding this comment.
test the output directly, instead of just testing it doesn't raise. You can use capsys to capture it.
Also would be nice to test a case that has an error and one that doesn't. Both presumably failed before, but we are still not testing one of them.
You just need to give a negative sigma to the Normal to get a case that fails (at least the logp, not sure about the dlgop).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes an IndexError that occurs when using model.debug() on scalar variables.
The issue was that the debug function attempted to index scalar variables using values[mask], which fails because scalars are 0-dimensional and cannot be indexed.
The fix adds a dimension check (values.ndim == 0) before indexing:
This ensures the debug function works correctly for both scalar and array random variables.
A regression test is included to prevent this bug from reappearing.
Related Issue
Checklist
Type of change