-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Following discussions with the Turing folks, it seems that there are (at least) two conflicting interpretations of the word "compile" when it comes to ReverseDiff and its tape API. To clarify, I will use the terminology from the ReverseDiff docs and sepatate two concepts:
- the recording of a new tape based on a function execution (using e.g.
ReverseDiff.GradientTape) - the compilation of an existing tape (using
ReverseDiff.compile)
In LogDensityProblems and Turing, if I understand correctly, passing compile = true means "record a tape and promise that it is safe to reuse later". The tape is then always compiled for increased speed.
In DifferentiationInterface on the other hand, passing compile = true means "when you record a tape during preparation, compile it for increased speed". A tape is always recorded during preparation (which is arguably not ideal for functions with value-dependent control flow).
I think we need to settle on a unified standard, and the right way to do that would be in ADTypes. Here are my propositions:
- Clarify what the
compileargument toAutoReverseDiffmeans at the moment: what is the interpretation we agree upon? - Add more details to the struct, something like
AutoReverseDiff(tape=true/false, compile=true/false)with defaults corresponding to the common interpretation in 1.
What do you think?
Related: