derive
Performs update of derivative after the rest of the formula in the back-pass.
For example, implementation of sin
function is:
fun AD.sin(x: Variable): Variable = derive(Variable(sin(x.x)) { z -> // call derive with function result
x.d += z.d * cos(x.x) // update derivative using chain rule and derivative of the function
}
Sources
common source
Link copied to clipboard