ChainRulesCore.jl
ChainRulesCore.jl copied to clipboard
`tangent * tangent` and `dot(tangent, tangent)` can return tangents.
I noticed that there are methods of *
and dot
for the AbstractZero
types that work like
Base.:*(::NoTangent, ::NoTangent) = NoTangent()
LinearAlgebra.dot(::NoTangent, ::ZeroTangent) = ZeroTangent()
However, if both arguments are tangents,
-
*
should not be defined. -
dot
should return a real number, not another tangent.
In my understanding, code that relies on such nonlinear tangent to tangent operations cannot be correct, so it may be worthwhile to remove such methods.