Chunked Forwards-Mode #533
Locked
willtebbutt
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
IIRC, ForwardDiff has some limitations on the argument type it supports. Can you look at ForwardDiff and see the differences between your proposal and ForwardDiff's chunked tangents? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Forwards-mode is taking shape nicely in #389 , but will initially only let you propagate a single tangent forwards at a time. We would ideally like to be able to propagate a collection of tangents forwards at the same time for efficiency reasons -- this is a common optimisation permitted by many systems.
In order to do this, we will require three extensions to the existing system:
frule!!s to handle it, andbuild_frulein order to handle this new system.Points 2 and 3 are self-explanatory, but point 1 requires some discussion.
Chunked-Tangent System
The basic idea here is to pair each primal
xwith a collection of tangentsts. I'm going to assume the chunk size statically, and bake it into type for the chunks (where appropriate). We might do something likei.e. the chunked tangent type for
Float64with chunk sizeNis the thing returned above.For
Arrays, we probably want the chunked tangent type to be anotherArraywith an extra dimension to contain the chunks. i.e. the chunked tangent type for aVector{Float64}would be aMatrix{Float64}, where the second dimension indexes over the chunks. We might want to shove this inside a container to make it semantically meaningful / to ensure that we can enforce statically that all active data has the same chunk size.For composite types like
Tuples,NamedTuples,structs, andmutable structs, we should push the chunks down to the leaves of the objects. i.e. the chunked tangent type forTuple{Vector{Float64}, Float64}should be aTuple{Matrix{Float64}, ChunkedPrimitiveTangent{...}}rather than aVector{Tuple{Vector{Float64},Float64}}.Beta Was this translation helpful? Give feedback.
All reactions