Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

VNT Part 3: VarNamedTuple with concretized slices#1181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
mhauru wants to merge5 commits intomhauru/arraylikeblock
base:mhauru/arraylikeblock
Choose a base branch
Loading
frommhauru/vnt-concretized-slices

Conversation

@mhauru
Copy link
Member

This PR primarily adds support for concretized slices to VarNamedTuple. That is actually all that is needed to make it support (Ithink) all the same: syntax we previously supported in@model. Turns out we were already concretising allVarNames in the model body itself, so there was little to do.

The PR also addresses some related issues, adds a test for:s (we previously had zero models in our test suite that used: in an assume statement), and starts a HISTORY.md entry.

If we are happy with all the new limitations on square bracket indexing, we could say that this makes VNT-for-LDF feature complete. However, adding support for dictionaries shouldn't be too hard, and maybe linear indexing wouldn't be awful either, so I would give those a day's worth of work before deciding that we just flat out ban them. Would be a shame to have a few DPPL versions for which they don't work, just to then add support in a few week's time.

To add support for the aforementioned cases (see also the HISTORY.md entry), my idea is that you would somehow provide VNT with information about which type of object thisVarName that has anIndexLens is indexing, and you could then do different things withmake_leaf andPartialArray depending on the type. That would solve theDict and linear indexing cases. Unusually indexed arrays would be harder, I don't know how to make e.g.OffsetArrays work without manually writing a version ofPartialArray that explicitly uses them. Maybe there could be some way to do this generically for anyAbstractArray subtype, but I worry that the interface forAbstractArray may not be well-defined enough for that.

@github-actions
Copy link
Contributor

github-actionsbot commentedDec 16, 2025
edited
Loading

Benchmark Report

  • this PR's head:d9e5405df819835daa81429e51343659cb444e3d
  • base branch:51b399aeb1f3c4ee29e1029215668b47847e0a15

Computer Information

Julia Version 1.11.8Commit cf1da5e20e3 (2025-11-06 17:49 UTC)Build Info:  Official https://julialang.org/ releasePlatform Info:  OS: Linux (x86_64-linux-gnu)  CPU: 4 × AMD EPYC 7763 64-Core Processor  WORD_SIZE: 64  LLVM: libLLVM-16.0.6 (ORCJIT, znver3)Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

Benchmark Results

┌───────────────────────┬───────┬─────────────┬───────────────────┬────────┬───────────────────────────────┬────────────────────────────┬─────────────────────────────────┐│                       │       │             │                   │        │       t(eval) / t(ref)        │     t(grad) / t(eval)      │        t(grad) / t(ref)         ││                       │       │             │                   │        │ ─────────┬──────────┬──────── │ ───────┬─────────┬──────── │ ──────────┬───────────┬──────── ││                 Model │   Dim │  AD Backend │           VarInfo │ Linked │     base │  this PR │ speedup │   base │ this PR │ speedup │      base │   this PR │ speedup │├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼──────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤│               Dynamic │    10 │    mooncake │             typed │   true │   362.87 │   367.82 │    0.99 │  10.99 │    9.30 │    1.18 │   3986.76 │   3421.18 │    1.17 ││                   LDA │    12 │ reversediff │             typed │   true │  2654.29 │  2629.67 │    1.01 │   4.99 │    5.01 │    0.99 │  13235.32 │  13184.79 │    1.00 ││   Loop univariate 10k │ 10000 │    mooncake │             typed │   true │ 57642.54 │ 57577.94 │    1.00 │   6.33 │    6.47 │    0.98 │ 364806.76 │ 372277.40 │    0.98 │├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼──────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤│    Loop univariate 1k │  1000 │    mooncake │             typed │   true │  5789.07 │  5839.36 │    0.99 │   5.86 │    6.41 │    0.91 │  33895.36 │  37445.75 │    0.91 ││      Multivariate 10k │ 10000 │    mooncake │             typed │   true │ 77221.12 │ 32136.04 │    2.40 │   5.72 │   10.25 │    0.56 │ 441474.70 │ 329428.33 │    1.34 ││       Multivariate 1k │  1000 │    mooncake │             typed │   true │  3438.12 │  3859.17 │    0.89 │   9.65 │    8.66 │    1.11 │  33187.58 │  33437.66 │    0.99 │├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼──────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤│ Simple assume observe │     1 │ forwarddiff │             typed │  false │     2.73 │     2.65 │    1.03 │   3.70 │    3.79 │    0.98 │     10.11 │     10.04 │    1.01 ││           Smorgasbord │   201 │ forwarddiff │             typed │  false │  1085.30 │  1080.16 │    1.00 │  68.07 │   71.13 │    0.96 │  73880.17 │  76832.58 │    0.96 ││           Smorgasbord │   201 │ forwarddiff │       simple_dict │   true │      err │      err │     err │    err │     err │     err │       err │       err │     err │├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼──────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤│           Smorgasbord │   201 │ forwarddiff │ simple_namedtuple │   true │      err │      err │     err │    err │     err │     err │       err │       err │     err ││           Smorgasbord │   201 │      enzyme │             typed │   true │  1475.81 │  1486.25 │    0.99 │   6.34 │    6.19 │    1.03 │   9359.66 │   9194.69 │    1.02 ││           Smorgasbord │   201 │    mooncake │             typed │   true │  1927.32 │  1495.11 │    1.29 │   4.42 │    5.84 │    0.76 │   8514.49 │   8726.19 │    0.98 │├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼──────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤│           Smorgasbord │   201 │ reversediff │             typed │   true │  1501.94 │  1478.95 │    1.02 │ 103.18 │  102.58 │    1.01 │ 154962.70 │ 151717.05 │    1.02 ││           Smorgasbord │   201 │ forwarddiff │      typed_vector │   true │  1585.03 │  1514.98 │    1.05 │  58.12 │   62.42 │    0.93 │  92122.84 │  94566.07 │    0.97 ││           Smorgasbord │   201 │ forwarddiff │           untyped │   true │  1481.08 │  1481.04 │    1.00 │ 140.11 │   64.57 │    2.17 │ 207512.44 │  95635.71 │    2.17 │├───────────────────────┼───────┼─────────────┼───────────────────┼────────┼──────────┼──────────┼─────────┼────────┼─────────┼─────────┼───────────┼───────────┼─────────┤│           Smorgasbord │   201 │ forwarddiff │    untyped_vector │   true │  1477.89 │  1486.72 │    0.99 │  60.66 │   67.16 │    0.90 │  89647.33 │  99849.10 │    0.90 ││              Submodel │     1 │    mooncake │             typed │   true │     3.28 │     3.34 │    0.98 │  10.81 │   10.69 │    1.01 │     35.49 │     35.67 │    1.00 │└───────────────────────┴───────┴─────────────┴───────────────────┴────────┴──────────┴──────────┴─────────┴────────┴─────────┴─────────┴───────────┴───────────┴─────────┘

@codecov
Copy link

codecovbot commentedDec 16, 2025
edited
Loading

Codecov Report

❌ Patch coverage is73.43750% with17 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.95%. Comparing base (51b399a) to head (d9e5405).

Files with missing linesPatch %Lines
src/test_utils/models.jl71.42%14 Missing⚠️
src/varnamedtuple.jl80.00%3 Missing⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@##           mhauru/arraylikeblock    #1181      +/-   ##=========================================================- Coverage                  80.13%   76.95%   -3.18%=========================================================  Files                         42       42                Lines                       4298     4343      +45     =========================================================- Hits                        3444     3342     -102- Misses                       854     1001     +147

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

DynamicPPL.jl documentation for PR#1181 is available at:
https://TuringLang.github.io/DynamicPPL.jl/previews/PR1181/

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

@mhaurumhauru

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@mhauru

[8]ページ先頭

©2009-2025 Movatter.jp