Open krishvishal opened 4 years ago
It seems the error arises from the use of LoopVectorization in your implementation of logsumexp
which tries to call typemin
which is not defined by ReverseDiff for ::Type{<:TrackedReal}
. I guess you could either specify the custom adjoint for Array{<:TrackedReal}
or not use LoopVectorization.
Any examples for adjoints of Array{Type}? I don't know how to do that.
This looks like an issue in DynamicPPL
. u
should be a TrackedArray
here.
Ok so I narrowed down the problem here to a Bijectors-ReverseDiff issue. The problem is that for the arraydist
of truncated Laplace
above, the bijector is a TruncatedBijector
with array lower and upper bounds. Applying this bijector to a TrackedArray
gives an array of TrackedReal
. I think this may be fixable.
julia> using Turing, ReverseDiff
julia> dist = arraydist(truncated.(Laplace.(0, [1, 2]), -10.0, 70.0));
julia> x = ReverseDiff.track(rand(dist));
julia> bijector(dist)(x)
2-element Array{ReverseDiff.TrackedReal{Float64,Float64,Nothing},1}:
TrackedReal<Fre>(-1.7994654328949322, 0.0, d6k, ---)
TrackedReal<Ggm>(-1.5788290245320968, 0.0, d6k, ---)
This https://github.com/TuringLang/Bijectors.jl/pull/142 should fix this issue.
Running the above code results in the following output/error.
Terminal output:
Full stacktrace: https://pastebin.com/hWvFG3sG
The custom adjoint I've defined for
logsumexp
function expectsTrackedArray
type butx
's type isArray{ReverseDiff.TrackedReal{Float64,Float64,Nothing},1}
.@mohamed82008