-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Description
@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:
using Turing
@model demo(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.
trappmartin
Metadata
Metadata
Assignees
Labels
No labels