Open torfjelde opened 1 year ago
Okay, so it turns out the error only shows up when using @grad_from_chainrules
because we somehow hit getindex
with the index being a boolean array (whose elements are then subsequently treated as integer indices in the pullback), while this does not happen when we use @grad
(for some reason).
~Is this maybe because @grad_from_chainrules
does not call value
one the input?~
EDIT: Nope; this is done: https://github.com/JuliaDiff/ReverseDiff.jl/blob/105290ffff86a5eccc55ca64feee0a1c52fffad0/src/macros.jl#L338
I unfortunately haven't been able to debug this properly yet, but I encountered a somewhat strange bug when using
@grad_from_chainrules
.In https://github.com/TuringLang/Bijectors.jl/actions/runs/5781513384/job/15666726634#step:5:274 you can see
If I then replace the offending rule with a "hard-coded" version using ChainRules, i.e. apply https://github.com/TuringLang/Bijectors.jl/pull/280/commits/29790dcd12e659d2f311b92b8f75a72e03802f5e, then the above error goes away :confused:
I don't have time to dig into this right now, but figured I'd put it here for future reference.