Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Language.Futhark.Interpreter.AD
Synopsis
- data Op
- data ADVariable
- data ADValue
- data Tape
- newtype VJPValue = VJPValue Tape
- data JVPValue = JVPValue ADValue ADValue
- doOp :: Op -> [ADValue] -> Maybe ADValue
- addFor :: PrimType -> BinOp
- primal :: ADValue -> ADValue
- tapePrimal :: Tape -> ADValue
- primitive :: ADValue -> PrimValue
- deriveTape :: Tape -> ADValue -> Maybe (Map Int ADValue)
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 Int ADVariable | |
Constant PrimValue |
Represents a computation tree, as well as every intermediate value in its evaluation. TODO: make this a graph.
Constructors
TapeID Int 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] 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.
tapePrimal :: Tape -> ADValue Source #
Returns the primal value of a Tape.