ChainRules.jl
ChainRules.jl copied to clipboard
Test concrete type constructors in addition to UnionAlls
In #23, we realized that while it's straightforward to test sensitivities for one-argument UnionAll constructors, e.g. Symmetric(X) and Diagonal(X), things can get more complicated when attempting to test constructors for concrete subtypes. The example in the linked PR was for Symmetric{T,M}, which requires a second argument when used as constructor. We should find a way to make it easier to test such things, perhaps by refactoring rrule_test?
perhaps by refactoring rrule_test?
I reckon this is the right way to go. We could just add an extra argument to rrule_test that contains the type to be passed to rrule i.e.
rrule_test(f, typeof(f), other_stuff...)
would be the new interface.
I noticed last night that we'd need to be careful about which argument is the one we're checking. Consider e.g. BLAS functions, which often have the differentiable argument last.