You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/FAQ.md
+16-7Lines changed: 16 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -56,14 +56,23 @@ For example in `access(xs, n) = xs[n]` then the derivative of `access` with resp
56
56
57
57
## When to use ChainRules vs ChainRulesCore?
58
58
59
-
[ChainRulesCore.jl](https://github.com/JuliaDiff/ChainRulesCore.jl) is a light-weight dependency for defining rules for functions in your packages, without you needing to depend on ChainRules itself. It has no dependencies of its own.
59
+
[ChainRulesCore.jl](https://github.com/JuliaDiff/ChainRulesCore.jl) is a light-weight dependency for defining rules for functions in your packages, without you needing to depend on ChainRules.jl itself.
60
+
It has almost no dependencies of its own.
61
+
If you only want to define rules, not use them, then you probably only want to load ChainRulesCore.jl.
60
62
61
-
[ChainRules.jl](https://github.com/JuliaDiff/ChainRules.jl) provides the full functionality, in particular it has all the rules for Base Julia and the standard libraries. Its thus a much heavier package to load.
62
-
63
-
If you only want to define rules, not use them then you probably only want to load ChainRulesCore.
64
-
AD systems making use of ChainRules should load ChainRules (rather than ChainRulesCore).
63
+
[ChainRules.jl](https://github.com/JuliaDiff/ChainRules.jl) provides the full functionality for AD systems, in particular it has all the rules for Base Julia and the standard libraries.
64
+
It is thus a much heavier package to load.
65
+
AD systems making use of `frule`s and `rrule`s should load ChainRules.jl.
65
66
66
67
## Where should I put my rules?
67
-
In general, we recommend adding custom sensitivities to your own packages with ChainRulesCore, rather than adding them to ChainRules.jl.
68
68
69
-
A few packages currently SpecialFunctions.jl and NaNMath.jl are in ChainRules.jl but this is a short-term measure.
69
+
We recommend adding custom rules to your own packages with [ChainRulesCore.jl](https://github.com/JuliaDiff/ChainRulesCore.jl), rather than adding them to ChainRules.jl.
70
+
A few packages - currently SpecialFunctions.jl and NaNMath.jl - have rules in ChainRules.jl as a short-term measure.
71
+
72
+
## How do I test my rules?
73
+
74
+
You can use [ChainRulesTestUtils.jl](https://github.com/JuliaDiff/ChainRulesTestUtils.jl) to test your custom rules.
75
+
ChainRulesTestUtils.jl has some dependencies, so it is a separate package from ChainRulesCore.jl.
76
+
This means your package can depend on the light-weight ChainRulesCore.jl, and make ChainRulesTestUtils.jl a test-only dependency.
77
+
78
+
Remember to read the section on [Writing Good Rules](@ref).
0 commit comments