Open
Description
the frule
/rrule
method signatures should have the same type constraints as the primal function (JuliaDiff/ChainRules.jl#175 (comment))
For example if your pacakge defines two methods for foo
:
foo(::Number) = ...
foo(::AbstractMatrix) = ...
prefer defining
frule((_, ẋ), ::typeof(foo), x::Union{Number, AbstractMatrix}) = ...
rrule(::typeof(foo), x::Union{Number, AbstractMatrix}) = ...
to defining
frule((_, ẋ), ::typeof(foo), x) = ...
rrule(::typeof(foo), x) = ...