ForwardDiff cannot determine ordering of Dual tags

Here’s my MWE

@model function mwe(::Type{T} = Vector{Float64}) where {T}
    lvar ~ Uniform(5.0,15.0)
    u ~ filldist(truncated(Laplace(55.0, lvar), 10, Inf),10) # u is cycle time of x to be reconstructed
    return u
end

mwemodel = mwe()
chainmwe = sample(mwemodel, NUTS(.65),3)

The error is:

Cannot determine ordering of Dual tags ForwardDiff.Tag{Turing.Core.var"#f#7"{DynamicPPL.VarInfo{NamedTuple{(:lvar, :u),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:lvar,Tuple{}},Int64},Array{Uniform{Float64},1},Array{DynamicPPL.VarName{:lvar,Tuple{}},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}},DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:u,Tuple{}},Int64},Array{Product{Continuous,Truncated{Laplace{Float64},Continuous,Float64},FillArrays.Fill{Truncated{Laplace{Float64},Continuous,Float64},1,Tuple{Base.OneTo{Int64}}}},1},Array{DynamicPPL.VarName{:u,Tuple{}},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64},DynamicPPL.Model{var"###evaluator#333",(:T,),Tuple{Type{Array{Float64,1}}},(),DynamicPPL.ModelGen{var"###generator#334",(:T,),(:T,),Tuple{Type{Array{Float64,1}}}}},DynamicPPL.Sampler{NUTS{Turing.Core.ForwardDiffAD{40},(),AdvancedHMC.DiagEuclideanMetric},Turing.Inference.SamplerState{DynamicPPL.VarInfo{NamedTuple{(:lvar, :u),Tuple{DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:lvar,Tuple{}},Int64},Array{Uniform{Float64},1},Array{DynamicPPL.VarName{:lvar,Tuple{}},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}},DynamicPPL.Metadata{Dict{DynamicPPL.VarName{:u,Tuple{}},Int64},Array{Product{Continuous,Truncated{Laplace{Float64},Continuous,Float64},FillArrays.Fill{Truncated{Laplace{Float64},Continuous,Float64},1,Tuple{Base.OneTo{Int64}}}},1},Array{DynamicPPL.VarName{:u,Tuple{}},1},Array{Float64,1},Array{Set{DynamicPPL.Selector},1}}}},Float64}}}},Float64} and Nothing
... 

and goes on for more characters than allowed in the body here. Not able to figure this out! Why isn’t this working?

Summoning @mohamed82008

1 Like

Hmm that’s an interesting one. Seems to be Laplace-related, other distributions seem to work. Please open an issue in Turing.

2 Likes

I have raised an issue at ForwardDiff cannot determine ordering of Dual tags for Laplace distributions · Issue #1300 · TuringLang/Turing.jl · GitHub

1 Like