-
Notifications
You must be signed in to change notification settings - Fork 160
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
Error in discard
returned by update
for DynamicDSLTrace with hierarchical addresses
#512
Comments
discard
returned by update
for DynamicDSLTrace with hierarchical addresses
Related #506 |
Thanks for catching this! So I'm trying to understand why the line of code you identified was introduced in the first place, and it looks like @alex-lew added it in this old commit: c8ce0d7 Apparently it was introduced to address cases where things were being discarded, but shouldn't be. So maybe we can check if the fix you suggested @fsaad also passes the original test case that @alex-lew added? This is the test case: Gen.jl/test/dsl/dynamic_dsl.jl Lines 153 to 183 in 0570918
|
@yifr and I just ran into this same issue. We tried out @fsaad 's solution and it works. We initially also thought it was the code @alex-lew points to, but actually that branch doesn't get run in @fsaad 's (and our own) examples because @fsaad 's reasoning for it being wrong is right – the original code has
But since I'll make a quick PR with the fix! |
Consider the following simple programs
Do we expect that
Gen.update
operates differently in these two cases. Formodel_ok
, if we callupdate
in such a way that reducesk
then the discard address{i}
are correctly placed in thediscard
, but inmodel_bad
, the address{:value => i}
are not in the discard. See following example:Discard for
model_ok
Discard for
model_bad
Possible Reason
The following lines seem to be the culprit: the recursive call to
add_unvisited_to_discard!
use an anonymous choicemap whensubdiscard
is empty, so the call toset_submap!
fills out asubdiscard
that we never access again.Gen.jl/src/dynamic/update.jl
Lines 177 to 181 in 7955b07
Changing these lines to
seems to fix the issue.
The text was updated successfully, but these errors were encountered: