Check the input length in logdensity - #1446
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1446 +/- ##
==========================================
+ Coverage 81.84% 81.85% +0.01%
==========================================
Files 50 50
Lines 3581 3583 +2
==========================================
+ Hits 2931 2933 +2
Misses 650 650 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
shravanngoswamii
force-pushed
the
sg/logdensity-dim-check
branch
from
August 23, 2026 19:38
39222c9 to
d7a66c8
Compare
Contributor
|
DynamicPPL.jl documentation for PR #1446 is available at: |
shravanngoswamii
force-pushed
the
sg/logdensity-dim-check
branch
from
August 23, 2026 19:43
d7a66c8 to
682d000
Compare
Contributor
Benchmarks @ b5f3ffbPerformance Ratio: gradient time divided by log-density time. For very small models these ratios are noisy across runs and machines; raw primal and gradient timings are more reliable. The benchmarks are aimed at DynamicPPL developers and mainly catch obvious allocation or type-stability regressions. See benchmark notes for details. Main @ e65fee2EnvironmentJulia Version 1.11.9 Commit 53a02c0720c (2026-02-06 00:27 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 4 × AMD EPYC 9V74 80-Core Processor WORD_SIZE: 64 LLVM: libLLVM-16.0.6 (ORCJIT, znver4) Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores) |
shravanngoswamii
force-pushed
the
sg/logdensity-dim-check
branch
from
August 25, 2026 10:07
682d000 to
e14fd43
Compare
A shorter vector gave a BoundsError from inside model evaluation and a longer one silently returned the density of the first `dimension(ldf)` elements.
shravanngoswamii
force-pushed
the
sg/logdensity-dim-check
branch
from
August 25, 2026 15:07
e14fd43 to
b5f3ffb
Compare
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.
Fixes #1445.
LogDensityProblems.logdensitynow checks the input length againstldf._dimand throws the sameArgumentErrorthat the two-argumentInitFromVector(vect, ldf)constructor already throws. Previously a shorter vector gave aBoundsErrorfrom inside model evaluation and a longer one silently returned the log density of the firstdimension(ldf)elements.ldf._dimis already stored, so the check costs nothing measurable. On a 21-dimensional model,logdensitytakes 48.3 ns before and 48.2 ns after.HISTORY.md also gains the missing entry for #1448, so the 0.42.5 section covers everything merged since 0.42.4. Project.toml is already at 0.42.5 on main.