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: src/dense.jl
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -298,7 +298,24 @@ Defined by [ADTypes.jl](https://github.com/SciML/ADTypes.jl).
298
298
299
299
# Fields
300
300
301
-
- `compile::Union{Val, Bool}`: whether to [compile the tape](https://juliadiff.org/ReverseDiff.jl/api/#ReverseDiff.compile) prior to differentiation (the boolean version is also the type parameter)
301
+
- `compile::Union{Val, Bool}`: whether to allow pre-recording and reusing a tape (which speeds up the differentiation process).
302
+
303
+
+ If `compile=false` or `compile=Val(false)`, a new tape must be recorded at every call to the differentiation operator.
304
+
+ If `compile=true` or `compile=Val(true)`, a tape can be pre-recorded on an example input and then reused at every differentiation call.
305
+
306
+
The boolean version of this keyword argument is taken as the type parameter.
307
+
308
+
!!! warning
309
+
310
+
Pre-recording a tape only captures the path taken by the differentiated function _when executed on the example input_.
311
+
If said function has value-dependent branching behavior, reusing pre-recorded tapes can lead to incorrect results.
312
+
In such situations, you should keep the default setting `compile=Val(false)`.
313
+
For more details, please refer to ReverseDiff's [`AbstractTape` API documentation](https://juliadiff.org/ReverseDiff.jl/dev/api/#The-AbstractTape-API).
314
+
315
+
!!! info
316
+
317
+
Despite what its name may suggest, the `compile` setting does not prescribe whether or not the tape is compiled with [`ReverseDiff.compile`](https://juliadiff.org/ReverseDiff.jl/dev/api/#ReverseDiff.compile) after being recorded.
318
+
This is left as a private implementation detail.
302
319
"""
303
320
struct AutoReverseDiff{C} <:AbstractADType
304
321
compile::Bool# this field is left for legacy reasons
0 commit comments