Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix for type-instability in
findranges
(#277)
TuringLang/Turing.jl#1661 With this PR: ```julia julia> using Turing, DynamicPPL, ReverseDiff julia> Turing.setadbackend(:reversediff); julia> @model function demo(x, ::Type{TV} = Vector{Float64}) where {TV} m = TV(undef, length(x)) m ~ MvNormal(length(x), 1.0) x ~ MvNormal(m, 1.0) end; julia> m = demo(randn(2)); julia> spl = DynamicPPL.Sampler(NUTS(0.65)) Sampler{NUTS{Turing.Core.ReverseDiffAD{false}, (), AdvancedHMC.DiagEuclideanMetric}}(NUTS{Turing.Core.ReverseDiffAD{false}, (), AdvancedHMC.DiagEuclideanMetric}(-1, 0.65, 10, 1000.0, 0.0), DynamicPPL.Selector(0x000f976df8fc2a48, :default, false)) julia> vi = DynamicPPL.VarInfo(m); julia> θ = vi[spl]; julia> new_vi = VarInfo(vi, spl, ReverseDiff.track(θ)); julia> eltype(new_vi, spl) # (✓) inference succeeds ReverseDiff.TrackedReal{Float64, Float64, ReverseDiff.TrackedArray{Float64, Float64, 1, Vector{Float64}, Vector{Float64}}} ```
- Loading branch information