You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Turing
@modeldemo(y, ::Type{T}= Float64) where {T} =begin
x =Vector{T}(undef, 10)
x .~Normal()
y .~Normal.(x, 1.0)
end
xval =rand(10)
varinfo = Turing.VarInfo(demo(xval))
logprob"y = rand(10) | model = demo, x = xval, varinfo = varinfo"
Pre-allocating is useful if we need to change xval or y in a loop and re-evaluate. Pre-allocating varinfo can be useful in these cases. However, as @trappmartin indicated, the syntax seems to imply we are conditioning on varinfo which we are not. One solution proposed in the PR was to use ; instead of , before varinfo. Another one that I prefer is to not expose this in the macro at all, and only allow it in the functional API under the hood.
The text was updated successfully, but these errors were encountered:
mohamed82008
changed the title
New prob syntax pre-allocation syntax
New prob macro - pre-allocation syntax
Dec 23, 2019
mohamed82008
changed the title
New prob macro - pre-allocation syntax
prob macro - pre-allocation syntax
Dec 23, 2019
Another one that I prefer is to not expose this in the macro at all, and only allow it in the functional API under the hood.
Yeah, I'd agree with that. The macro is really more for people who want to query their data quickly, while the API might be more for power users who want to root around in performance-land.
@trappmartin brought up an issue in TuringLang/Turing.jl#997 about the syntax for pre-allocating
varinfo
. After the PR is merged, we can do:Pre-allocating is useful if we need to change
xval
ory
in a loop and re-evaluate. Pre-allocatingvarinfo
can be useful in these cases. However, as @trappmartin indicated, the syntax seems to imply we are conditioning onvarinfo
which we are not. One solution proposed in the PR was to use;
instead of,
beforevarinfo
. Another one that I prefer is to not expose this in the macro at all, and only allow it in the functional API under the hood.The text was updated successfully, but these errors were encountered: