ChainRules.jl
ChainRules.jl copied to clipboard
Fixing and testing rules for functions with real and complex inputs
There are quite a few rules where mixing complex and real inputs will result in the cotangent of a real input being complex. I proposed in JuliaDiff/ChainRulesCore.jl#176 that the right way to do things is actually to remove the imaginary part of the cotangent for real inputs. This is actually necessary in order to verify these rules with FiniteDifferences, so in general we do not actually test these mixtures.
If we choose to adopt this standard (I think we should), then we need to identify rrules that could take a mixture of real and complex inputs and ensure that the pullback projects if necessary, then add tests to that effect.
See also #232 cc @oxinabox