Open ChrisRackauckas opened 4 years ago
I have zero ideas for how ChainRules can be enhanced to support them. We need to sit down with @willtebbutt and @mikeinnes and think hard.
I might be stating the obvious because I'm just starting to think about this, I think the only way to do this is to use the fact that Dual
is not user facing API. But we're allowed to do any program transform inside the dualrun
context...
So some obvious things might get us going:
x[i] = a
then it can start a dual number cache for x
: we can also make this thing tightly typed using errors and restart (I wish every day that we had continuations), but if we hope that, for a setindex, the type of the dual does not change (I bet it does not change more than a couple of times in any good use case) then we're in good shape.x[j]
can be hijacked to look up this cache for its dual parts.
Things like
mul!
are important here, given the DualCache style of support. @oxinabox how should we be implementing derivatives for these? @jrevels mentioned that ChainRules.jl does have support for it. We need to basically say "check to make sure it's a dual of the right size, and then if so, use these mutating functions ..."