-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
DAG construction with local variables #253
Comments
call |
Got it, thank you @thautwarm ! julia> unwrap_scoped(ex) =
@match ex begin
Expr(:scoped, _, a) => unwrap_scoped(a)
Expr(head, args...) => Expr(head, map(unwrap_scoped, args)...)
a => a
end
unwrap_scoped (generic function with 1 method)
julia> m = @model begin
a ~ For(3) do x Normal(μ=x) end
x ~ Normal(μ=sum(a))
end;
julia> m.dists.a |> MacroTools.prettify |> simplify_ex |> solve_from_local |> unwrap_scoped
:((@global For)(function (x,)
(@global Normal)(μ = @local x)
end, 3)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had brought this up in #245, but I think it's really a different issue, so I'm splitting it.
The problem is in models like
Soss thinks the graph is
But this is wrong! The
x
referred to ina ~ ...
is a local variable.I think JuliaVariables.jl ought to be able to help with this. The idea is
solve
each rhs, which adds@local
and@global
annotations@global
ones, which should give the true dependenciesHere's my first attempt:
I'm not sure what's going on in that
@global x
, sincex
is clearly a local variable. My guess is that thedo
notation is throwing off the solver and needs to be rewritten.The text was updated successfully, but these errors were encountered: