ChainRules.jl icon indicating copy to clipboard operation
ChainRules.jl copied to clipboard

Test concrete type constructors in addition to UnionAlls

Open ararslan opened this issue 6 years ago • 2 comments

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?

ararslan avatar Apr 23 '19 18:04 ararslan

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.

willtebbutt avatar Apr 23 '19 18:04 willtebbutt

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.

ararslan avatar Apr 25 '19 19:04 ararslan