Skip to content

Raise ValueError for negative plate sizes#3451

Open
kimjune01 wants to merge 1 commit into
pyro-ppl:devfrom
kimjune01:fix-negative-plate-size
Open

Raise ValueError for negative plate sizes#3451
kimjune01 wants to merge 1 commit into
pyro-ppl:devfrom
kimjune01:fix-negative-plate-size

Conversation

@kimjune01
Copy link
Copy Markdown

Fixes #3407.

Negative size in pyro.plate() silently produces incorrect log-likelihood
scaling — size / batch_size becomes negative. The existing validation
catches size == 0 but not negative values.

Add a ValueError check before the _Subsample distribution is created.

Negative plate sizes silently produce incorrect log-likelihood scaling
(size/batch_size becomes negative). Add an early validation check in
SubsampleMessenger._subsample to raise a clear ValueError before any
downstream computation occurs.

Fixes pyro-ppl#3407
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.

Feature request: Prohibit passing negative numbers to plate sizes

1 participant