Open
Description
We currently use the following DynamicPPL syntax to support AutoDiff.
@model function f(N, ::Type{T}=Vector{Float64}) where {T}
a = T(undef, N)
a .~ Normal()
m = sum(a)
o = T(undef, N)
o .~ Normal(m, 1)
end
We still need the parametric type (..., ::Type{T}=Vector{Float64}) where {T}
for operator-overloading approaches like ForwardDiff and ReverseDiff. However, this is no longer necessary for Mooncake, which is source-transformation-based.
There might be a way to work around such requirements for ForwardDiff and ReverseDiff by implementing a (simple) model (AST) expression transform similar to Mooncake's. Such an approach is a bit speculative at the moment, but it is worth considering to simplify the modelling syntax.
cc @willtebbutt