futhark-0.25.23: An optimising compiler for a functional, array-oriented language.
Safe HaskellSafe-Inferred
LanguageGHC2021

Language.Futhark.Interpreter.AD

Synopsis

Documentation

data Op Source #

Instances

Instances details
Show Op Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

Methods

showsPrec :: Int -> Op -> ShowS #

show :: Op -> String #

showList :: [Op] -> ShowS #

data ADVariable Source #

Constructors

VJP VJPValue 
JVP JVPValue 

Instances

Instances details
Show ADVariable Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

data ADValue Source #

Instances

Instances details
Show ADValue Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

data Tape Source #

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

Instances

Instances details
Show Tape Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

Methods

showsPrec :: Int -> Tape -> ShowS #

show :: Tape -> String #

showList :: [Tape] -> ShowS #

newtype VJPValue Source #

Constructors

VJPValue Tape 

Instances

Instances details
Show VJPValue Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

data JVPValue Source #

In JVP, the derivative of the variable must be saved. This is represented as a second value.

Constructors

JVPValue ADValue ADValue 

Instances

Instances details
Show JVPValue Source # 
Instance details

Defined in Language.Futhark.Interpreter.AD

tapePrimal :: Tape -> ADValue Source #

Returns the primal value of a Tape.

deriveTape :: Tape -> ADValue -> Maybe (Map Int ADValue) Source #

This calculates every partial derivative of a Tape. The result is a map of the partial derivatives, each key corresponding to the ID of a free variable (see TapeID).