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 Random: AbstractRNG
using Distributions: DiscreteMultivariateDistribution
import Distributions: rand, logpdf
struct DSL <:DiscreteMultivariateDistributionendfunctionlogpdf(dsl::DSL, dsl_numeric::AbstractVector{Int})
returnsum([log(0.5) *0.5^i for i in1:length(dsl_numeric)])
endfunctionrand(rng::AbstractRNG, dsl::DSL)
fst =rand(rng, [0, 1])
dsl_numeric = [fst]
whilerand() <0.5push!(dsl_numeric, rand(rng, [0, 1]))
endreturn dsl_numeric
endusing Turing
@modelfunctionmwe()
dsl ~DSL()
end
chain =sample(mwe(), PG(10), 500)
gives
Stacktrace in the failed task:
tried to assign 2 elements to 7 destinations
throw_setindex_mismatch(::Array{Int64,1}, ::Tuple{Int64}) at indices.jl:191
setindex_shape_check at indices.jl:242 [inlined]
setindex! at array.jl:850 [inlined]
setval!(::DynamicPPL.VarInfo{NamedTuple{(:dsl,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:dsl},Int64},Array{DSL,1},Array{DynamicPPL.VarName{:dsl},1},Array{Int64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64}, ::Array{Int64,1}, ::DynamicPPL.VarName{:dsl}) at varinfo.jl:284
setindex!(::DynamicPPL.VarInfo{NamedTuple{(:dsl,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:dsl},Int64},Array{DSL,1},Array{DynamicPPL.VarName{:dsl},1},Array{Int64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64}, ::Array{Int64,1}, ::DynamicPPL.VarName{:dsl}) at varinfo.jl:939
assume(::DynamicPPL.Sampler{PG{()},Turing.Inference.PGState{DynamicPPL.VarInfo{NamedTuple{(:dsl,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:dsl},Int64},Array{DSL,1},Array{DynamicPPL.VarName{:dsl},1},Array{Int64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Float64}}, ::DSL, ::DynamicPPL.VarName{:dsl}, ::DynamicPPL.VarInfo{NamedTuple{(:dsl,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:dsl},Int64},Array{DSL,1},Array{DynamicPPL.VarName{:dsl},1},Array{Int64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64}) at AdvancedSMC.jl:272
_tilde at context_implementations.jl:39 [inlined]
tilde at context_implementations.jl:18 [inlined]
macro expansion at compiler.jl:348 [inlined]
macro expansion at In[4]:9 [inlined]
##inner_function#340#6 at compiler.jl:493 [inlined]
#_#5 at model.jl:24 [inlined]
Model at model.jl:24 [inlined]
Model at model.jl:23 [inlined]
#3 at container.jl:37 [inlined]
(::Libtask.var"#1#2"{Turing.Core.var"#3#4"{DynamicPPL.Model{var"##inner_function#340#6",NamedTuple{(),Tuple{}},DynamicPPL.ModelGen{(),var"###mwe#348",NamedTuple{(),Tuple{}}},Val{()}},DynamicPPL.Sampler{PG{()},Turing.Inference.PGState{DynamicPPL.VarInfo{NamedTuple{(:dsl,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:dsl},Int64},Array{DSL,1},Array{DynamicPPL.VarName{:dsl},1},Array{Int64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},Float64}},DynamicPPL.VarInfo{NamedTuple{(:dsl,),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:dsl},Int64},Array{DSL,1},Array{DynamicPPL.VarName{:dsl},1},Array{Int64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64}}})() at taskcopy.jl:38
The text was updated successfully, but these errors were encountered:
MEW:
gives
The text was updated successfully, but these errors were encountered: