Make ZeroTangent() == 0
I feel like we can overload == for ZeroTangent()`
to do something like
==(::ZeroTangent, a) = iszero(a)
would also need to overload hash
since all things that are equal to zero in julia have the same hash, buit we can just call hash(0, h)
this would be useful for testhing some of the stuff i am working on to not AD things that don't appear in this function.
For testing purposes, would it be sufficient to overload ≈ instead? That would avoid hash complications, and maybe invalidations.
Like here: https://github.com/JuliaDiff/Diffractor.jl/pull/73/files#diff-fba4d4a7c64aacd9b1a662bca4487f3e849b43f09e65f6c8788a3f142b989f65R27-R32
I want to test exact equality, though, not approximate.
And I want equality on tuples to work.
(isapprox isn't defined for tuples)
The hash complication is trivially resolved.
I hope there are not major invalidation issues, especially if we restrict it to Number. (or perhaps Union{Number,Array})
We did have to remove it from thunks, but that was unrestricted:
https://github.com/JuliaDiff/ChainRulesCore.jl/pull/524
Not having this is causing issues for Diffractor I look into this further soon and see what (if any) invalidation issues there are.