Safe Haskell | None |
---|---|
Language | GHC2021 |
Language.Futhark.Interpreter.AD
Synopsis
- data Op
- data ADVariable
- data ADValue
- data Tape
- newtype VJPValue = VJPValue Tape
- data JVPValue = JVPValue ADValue ADValue
- newtype Counter = Counter Int
- newtype Depth = Depth Int
- doOp :: Op -> [ADValue] -> Counter -> Either String (ADValue, Counter)
- addFor :: PrimType -> BinOp
- tapePrimal :: Tape -> ADValue
- primitive :: ADValue -> PrimValue
- varPrimal :: ADVariable -> PrimValue
- deriveTape :: Tape -> ADValue -> Counter -> Either String (Map Counter ADValue, Counter)
- unionWithM :: (Monad m, Ord k) => (a -> a -> m a) -> Map k a -> Map k a -> m (Map k a)
- unionsWithM :: (Foldable f, Monad m, Ord k) => (a -> a -> m a) -> f (Map k a) -> m (Map k a)
Documentation
data ADVariable Source #
Instances
Show ADVariable Source # | |
Defined in Language.Futhark.Interpreter.AD Methods showsPrec :: Int -> ADVariable -> ShowS # show :: ADVariable -> String # showList :: [ADVariable] -> ShowS # |
Constructors
Variable Depth ADVariable | |
Constant PrimValue |
Represents a computation tree, as well as every intermediate value in its evaluation.
Constructors
TapeID Counter ADValue | This represents a variable. Each variable is given a unique ID, and has an initial value |
TapeConst ADValue | This represents a constant. |
TapeOp Op [Tape] Counter ADValue | This represents the application of a mathematical operation. Each parameter is given by its Tape, and the return value of the operation is saved |
In JVP, the derivative of the variable must be saved. This is represented as a second value.
Used to uniquely identify values.
An indication of the nesting depth of AD. This is used to avoid pertubation confusion.
tapePrimal :: Tape -> ADValue Source #
Returns the primal value of a Tape.
varPrimal :: ADVariable -> PrimValue Source #