Function Transforms #
Automatic differentiation transforms for one-argument tensor programs.
Write programs against the differentiable operation interface, rather than extracting host
values and computing outside the recorded graph. The same program can be interpreted with
different scalar types; this is not source-code differentiation of an arbitrary Lean function.
Import NN.API.Autograd for the complete public autograd API.
A scalar-polymorphic tensor function written against TorchLean's differentiable operations.
Instances For
Present a Function as the one-argument Program the autograd runtime consumes.
The wrapping is pure plumbing: curry turns the runtime's heterogeneous argument list into the
single ValueRef a Function expects. Every differentiation entry point below goes through here,
so exactly one place knows the arity convention.
Instances For
Differentiate a scalar-valued function with respect to its input.
By default this returns only the gradient. Set value := true to return
(gradient, functionValue) from the same evaluation.