Portability | GHC only |
---|---|
Stability | experimental |
Maintainer | ekmett@gmail.com |
Reverse-Mode Automatic Differentiation implementation details
For reverse mode AD we use System.Mem.StableName.StableName
to recover sharing information from
the tape to avoid combinatorial explosion, and thus run asymptotically faster
than it could without such sharing information, but the use of side-effects
contained herein is benign.
- newtype Reverse a = Reverse (Tape a (Reverse a))
- data Tape a t
- partials :: Num a => AD Reverse a -> [(Int, a)]
- partialArray :: Num a => (Int, Int) -> AD Reverse a -> Array Int a
- partialMap :: Num a => AD Reverse a -> IntMap a
- derivative :: Num a => AD Reverse a -> a
- derivative' :: Num a => AD Reverse a -> (a, a)
- class Primal v => Var v where
- bind :: (Traversable f, Var v) => f a -> (f (v a), (Int, Int))
- unbind :: (Functor f, Var v) => f (v a) -> Array Int a -> f a
- unbindMap :: (Functor f, Var v, Num a) => f (v a) -> IntMap a -> f a
- unbindWith :: (Functor f, Var v, Num a) => (a -> b -> c) -> f (v a) -> Array Int b -> f c
- unbindMapWithDefault :: (Functor f, Var v, Num a) => b -> (a -> b -> c) -> f (v a) -> IntMap b -> f c
Documentation
Reverse
is a Mode
using reverse-mode automatic differentiation that provides fast diffFU
, diff2FU
, grad
, grad2
and a fast jacobian
when you have a significantly smaller number of outputs than inputs.
partials :: Num a => AD Reverse a -> [(Int, a)]Source
This returns a list of contributions to the partials. The variable ids returned in the list are likely not unique!
derivative :: Num a => AD Reverse a -> aSource
derivative' :: Num a => AD Reverse a -> (a, a)Source