Check the input length in logdensity - #1446
Open
shravanngoswamii wants to merge 2 commits into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1446 +/- ##
==========================================
- Coverage 81.70% 81.57% -0.13%
==========================================
Files 50 50
Lines 3581 3583 +2
==========================================
- Hits 2926 2923 -3
- Misses 655 660 +5 ☔ 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: |
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 23, 2026 19:43
d7a66c8 to
682d000
Compare
Contributor
Benchmarks @ 682d000Performance 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 @ a8b0145EnvironmentJulia 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) |
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.