JuliaDiff / ChainRulesTestUtils.jl

Utilities for testing custom AD primitives.
MIT License
50 stars 15 forks source link

Testing All The Differentials #15

Open willtebbutt opened 4 years ago

willtebbutt commented 4 years ago

The frule and rrule testing functionality is now pretty decent. However, there is not good utility functionality to assist in writing tests for how each of the various AbstractDifferentials play with each of the frules and rrules.

Ideally frule_test and rrule_test will be set up such that each possible combination of arguments to each pushforward and pullback are tested separately, and for the most part automatically.

edit: on second thoughts, we should consider whether or not we actually want to test all of the possible combinations, or just make sure that each argument sees each AbstractDifferential, since the pushforwards and pullbacks are linear in their arguments.

oxinabox commented 4 years ago

Cross ref: https://github.com/JuliaDiff/ChainRulesCore.jl/issues/8#issuecomment-543634420

We need to test only with differentials of kinds that match to the primal kinds.

For example we only need to test for support for One(), if it is a function of scalars.

Similarly, we only need to test Composite{SVD} on functions of SVD objects, not on functions of QR objects.