-
Notifications
You must be signed in to change notification settings - Fork 37
Fix compiler output for sub-variables of immutable data #1177
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
penelopeysm
wants to merge
1
commit into
main
Choose a base branch
from
py/immutable
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+59
−11
Conversation
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
Contributor
Benchmark Report
Computer InformationBenchmark Results |
50f1943 to
870faab
Compare
Contributor
|
DynamicPPL.jl documentation for PR #1177 is available at: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1177 +/- ##
==========================================
+ Coverage 78.95% 78.96% +0.01%
==========================================
Files 41 41
Lines 3896 3899 +3
==========================================
+ Hits 3076 3079 +3
Misses 820 820 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Closes #1176. The result of this PR on the model macro
is shown in the following diff. Essentially the result is to avoid setting to
data.xdirectly:quote function test(__model__::Model, __varinfo__::AbstractVarInfo, data::Any; ) #= REPL[4]:1 =# begin var"##dist#246" = Normal() var"##vn#243" = (DynamicPPL.resolve_varnames)((VarName){:data}((Accessors.opticcompose)((Accessors.PropertyLens){:x}())), var"##dist#246") var"##isassumption#244" = begin if (DynamicPPL.contextual_isassumption)(__model__.context, (prefix)(__model__.context, var"##vn#243")) if !((DynamicPPL.inargnames)(var"##vn#243", __model__)) || (DynamicPPL.inmissings)(var"##vn#243", __model__) true else data.x === missing end else false end end begin #= /Users/pyong/ppl/dppl/src/compiler.jl:599 =# var"##retval#248" = if (DynamicPPL.contextual_isfixed)(__model__.context, (prefix)(__model__.context, var"##vn#243")) - data.x = (DynamicPPL.getfixed_nested)(__model__.context, (prefix)(__model__.context, var"##vn#243")) + data = (Accessors.set)(data, (BangBang.AccessorsImpl.prefermutation)((Accessors.opticcompose)((Accessors.PropertyLens){:x}())), (DynamicPPL.getfixed_nested)(__model__.context, (prefix)(__model__.context, var"##vn#243"))) elseif var"##isassumption#244" begin (var"##value#247", __varinfo__) = (tilde_assume!!)(__model__.context, (DynamicPPL.unwrap_right_vn)((DynamicPPL.check_tilde_rhs)(var"##dist#246"), var"##vn#243")..., __varinfo__) data = (Accessors.set)(data, (BangBang.AccessorsImpl.prefermutation)((Accessors.opticcompose)((Accessors.PropertyLens){:x}())), var"##value#247") var"##value#247" end else - data.x = if (DynamicPPL.inargnames)(var"##vn#243", __model__) + var"##supplied_val#236" = if (DynamicPPL.inargnames)(var"##vn#243", __model__) data.x else (DynamicPPL.getconditioned_nested)(__model__.context, (prefix)(__model__.context, var"##vn#243")) end - (var"##value#245", __varinfo__) = (tilde_observe!!)(__model__.context, (DynamicPPL.check_tilde_rhs)(var"##dist#246"), data.x, var"##vn#243", __varinfo__) + (var"##value#245", __varinfo__) = (tilde_observe!!)(__model__.context, (DynamicPPL.check_tilde_rhs)(var"##dist#246"), var"##supplied_val#236", var"##vn#243", __varinfo__) + data = (Accessors.set)(data, (BangBang.AccessorsImpl.prefermutation)((Accessors.opticcompose)((Accessors.PropertyLens){:x}())), var"##value#245") var"##value#245" end #= /Users/pyong/ppl/dppl/src/compiler.jl:600 =# return (var"##retval#248", __varinfo__) end end end begin $(Expr(:meta, :doc)) function test(data::Any; ) #= REPL[4]:1 =# return (Model){false}(test, NamedTuple{(:data,)}((data,)); ) end end end