Description
Zygote defines an adjoint of AbstractFFTs.[i]rfft
here.
On the other hand, AbstractFFTs
defines rrule
s for [i]rfft
and other functions itself (implemented by @devmotion ) here
I assume that Zygote prefers its own adjoint over the ChainRulesCore.rrule
of AbstractFFTs
(at least that is what I think I'm seeing).
Now the problem is that the two implementations differ (not just by the additional projection into the real domain, but by additional scaling factors) and give different results.
I haven't yet taken the time to figure out how the scaling factors in AbstractFFTs
are motivated (unfortunately there's no comment that gives a hint), but finite differencing seems to agree with AbstractFFTs
implementation and disagree with Zygote's.
Side question: Can I somehow tell Zygote to prefer the ChainRulesCore.rrule
over its own @adjoint
?