Skip to content

Validate multinomial pvals in JAX and PyTorch backends#3220

Merged
FlorianPfaff merged 5 commits into
mainfrom
fix-multinomial-boolean-pvals-backends
Jun 27, 2026
Merged

Validate multinomial pvals in JAX and PyTorch backends#3220
FlorianPfaff merged 5 commits into
mainfrom
fix-multinomial-boolean-pvals-backends

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Owner

Summary

  • add real-numeric validation for random.multinomial(..., pvals=...) in the JAX backend
  • add matching real-numeric validation for the PyTorch backend
  • add optional-backend regression tests covering boolean and complex pvals rejection while preserving valid real inputs

Bug fixed

The NumPy backend already rejects boolean and other non-real multinomial probability vectors, but the JAX and PyTorch backends cast pvals directly to floating-point tensors/arrays. That silently accepted boolean vectors such as [True, False] as probabilities instead of enforcing the PyRecEst backend contract consistently.

Validation

  • Used GitHub compare/fetch inspection to verify that only the intended source and regression-test files changed.
  • The execution sandbox cannot resolve github.com, so I could not clone/install the repository to run full pytest locally. The added tests are isolated optional-backend pytest cases and skip cleanly when JAX/PyTorch are unavailable.

@FlorianPfaff FlorianPfaff enabled auto-merge (squash) June 27, 2026 09:04
@github-actions

github-actions Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 76.63s
✅ JSON prettier 7 0 0 0 0.82s
✅ JSON v8r 7 0 0 5.15s
✅ MARKDOWN markdownlint 68 0 0 0 1.99s
✅ MARKDOWN markdown-table-formatter 68 0 0 0 0.76s
✅ PYTHON black 1049 49 0 0 67.52s
✅ PYTHON isort 1049 71 0 0 4.81s
✅ REPOSITORY checkov yes no no 49.85s
✅ REPOSITORY gitleaks yes no no 8.61s
✅ REPOSITORY git_diff yes no no 0.19s
✅ REPOSITORY secretlint yes no no 33.22s
✅ REPOSITORY syft yes no no 4.04s
✅ REPOSITORY trivy-sbom yes no no 12.21s
✅ REPOSITORY trufflehog yes no no 22.22s
✅ YAML prettier 11 0 0 0 0.75s
✅ YAML v8r 11 0 0 12.15s
✅ YAML yamllint 11 0 0 0.41s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.5.0 --custom-flavor-setup --custom-flavor-linters PYTHON_BLACK,PYTHON_ISORT,COPYPASTE_JSCPD,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@FlorianPfaff FlorianPfaff merged commit 72128fe into main Jun 27, 2026
26 checks passed
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.

1 participant