LabelledArrays looks very promising to simplify model definitions. Unfortunately it seem largely incompatible with AD. Is there a good workaround?
using LabelledArrays
import ForwardDiff
import Zygote
model(p) = p.a + p.b^2 + p.c^3
p = LVector(a=1, b=2, c=3)
ps = SLVector(a=1, b=2, c=3)
model(ps)
model(p)
ForwardDiff.gradient(model, p) # works :)
Zygote.gradient(model, p) # ERROR: ArgumentError: invalid index: Val{:c}() of type Val{:c}
ForwardDiff.gradient(model, ps) # ERROR: type SArray has no field a
Zygote.gradient(model, ps) # ERROR: ArgumentError: invalid index: Val{:c}() of type Val{:c}
(In case of ForwardDiff this is probably related to #68)
LabelledArrays looks very promising to simplify model definitions. Unfortunately it seem largely incompatible with AD. Is there a good workaround?
(In case of
ForwardDiffthis is probably related to #68)