-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
For such an important function which is used extensively across DynamicPPL and Turing, there is a surprising lack of safety in that extra parameters in the supplied vector are just silently dropped:
julia> using DynamicPPL, Distributions
julia> @model f() = x ~ Normal()
f (generic function with 2 methods)
julia> v = VarInfo(f())
VarInfo{@NamedTuple{x::DynamicPPL.Metadata{Dict{VarName{:x, typeof(identity)}, Int64}, Vector{Normal{Float64}}, Vector{VarName{:x, typeof(identity)}}, Vector{Float64}}}, Float64}((x = DynamicPPL.Metadata{Dict{VarName{:x, typeof(identity)}, Int64}, Vector{Normal{Float64}}, Vector{VarName{:x, typeof(identity)}}, Vector{Float64}}(Dict(x => 1), [x], UnitRange{Int64}[1:1], [-0.6762290805408931], Normal{Float64}[Normal{Float64}(μ=0.0, σ=1.0)], [0], Dict{String, BitVector}("del" => [0], "trans" => [0])),), Base.RefValue{Float64}(-1.1475814178892636), Base.RefValue{Int64}(0))
julia> DynamicPPL.unflatten(v, [0.0, 1.0, 2.0])
VarInfo{@NamedTuple{x::DynamicPPL.Metadata{Dict{VarName{:x, typeof(identity)}, Int64}, Vector{Normal{Float64}}, Vector{VarName{:x, typeof(identity)}}, Vector{Float64}}}, Float64}((x = DynamicPPL.Metadata{Dict{VarName{:x, typeof(identity)}, Int64}, Vector{Normal{Float64}}, Vector{VarName{:x, typeof(identity)}}, Vector{Float64}}(Dict(x => 1), [x], UnitRange{Int64}[1:1], [0.0], Normal{Float64}[Normal{Float64}(μ=0.0, σ=1.0)], [0], Dict{String, BitVector}("del" => [0], "trans" => [0])),), Base.RefValue{Float64}(-1.1475814178892636), Base.RefValue{Int64}(0))
Metadata
Metadata
Assignees
Labels
No labels