Vouivre Digital

Dependent type infrastructure for machine learning

(vouivre autodiff)

The autodiff module provides automatic differentiation in both forward and reverse accumulation modes, along with several differentiable functions that can be used as is or to build more complex differentiable functions. These are re-exported in partially applicable form by the (vouivre base) module documented further below.

Scheme Procedure: * x y

Differentiable element-wise multiplication.

Scheme Procedure: + x y

Differentiable element-wise addition.

Scheme Procedure: - x y

Differentiable element-wise subtraction.

Scheme Procedure: / x y

Differentiable element-wise division.

Scheme Procedure: abs x

Differentiable absolute.

Scheme Procedure: adot x y n

Differentiable array dot product.

Scheme Procedure: amap2 f x y

Differentiable functional mapping on corresponding rows of two arrays with
rank > 0.

Scheme Procedure: array-cell-ref x . indices

Differentiable `array-cell-ref' w.r.t the first argument.

Scheme Procedure: array-ref x . indices

Differentiable `array-ref' w.r.t the first argument.

Scheme Procedure: cos x

Differentiable cosine.

Scheme Procedure: differentiable-wrapper generators proc* arg . more

Helper for defining differentiable functions.

generators: A list of generating procedures that, take the given arguments
            along with an absolute input index, an absolute output index,
            and zero or more data points, to produce a corresponding jacobian
            element.

proc*:      A list containing the function to be differentiated and zero or
            more procedures that also take the given arguments to create,
            in the forward pass, the data points that are latter fed to the
            generators.

arg . more: The arguments to all these procedures.

NOTE: In cases where an argument isn't meant to be differentiated against, its
      corresponding generator should be `#f'.

Scheme Procedure: ewise1 f

Helper for creating the jacobian generator of one argument functions created
with the `extend' procedure.

Scheme Procedure: ewise2 proc axis

Helper for creating the jacobian generators of two argument functions created
with the `extend' procedure.

Scheme Procedure: exp x

Differentiable exponential.

Scheme Procedure: expt x y

Differentiable power.

Scheme Procedure: extend f

Extend a function of one or more scalars to apply to numbers/arrays
element-wise. All arrays must have the same dimension.

Scheme Procedure: fdiff f [axis]

Automatic differentiation in forward accumulation mode w.r.t. the
function argument at the given index.

Scheme Procedure: fold f init lst . more

Differentiable fold of a differentiable function.

Scheme Procedure: identity x

Differentiable identity.

Scheme Procedure: log x

Differentiable logarithm.

Scheme Procedure: logsumexp x

Differentiable RealSoftMax using the log-sum-exp trick.

Scheme Procedure: make-batch elem . more

Differentiable function to batch one or more arrays together.

Scheme Procedure: max x y

Differentiable element-wise maximum.

Scheme Procedure: maximum x

Differentiable maximum on arrays.

Scheme Procedure: mean x

Differentiable mean on arrays.

Scheme Procedure: min x y

Differentiable element-wise minimum.

Scheme Procedure: rdiff f [axis]

Automatic differentiation in reverse accumulation mode w.r.t. the
function argument at the given index.

Scheme Procedure: reduce f default lst

Differentiable reduce of a differentiable function.

Scheme Procedure: relu x

Differentiable rectified linear unit.

Scheme Procedure: sin x

Differentiable sine.

Scheme Procedure: sqrt x

Differentiable square root.

Scheme Procedure: sum x

Differentiable sum on arrays.

Scheme Procedure: tan x

Differentiable tangent.

(vouivre mnist)

The mnist module is used to download and load the MNIST dataset.

Scheme Procedure: load-mnist nb-items download?

Return the given number of data points from the MNIST dataset downloading it
if needed and requested in the ./mnist directory.

The data is a cons cell containing an array (nb-items, height, width) of
training images and an array (nb-items) of corresponding labels.

(vouivre curry)

The curry module provides infrastructure for partially applicable functions and compile time verification. This page documents its public interface. See the source code for implementation details.

Scheme Procedure: equal-types? ta tb

Check the equality of two types.

Scheme Procedure: expand symtab expr

Type check an expression returning two values: its resulting type and an
expansion where all applications of symbols present in the symtab are curried.
Raise a type error if the expression is invalid.

Scheme Procedure: parse x

Parse a type from its cons cells representation to a tree.

Scheme Procedure: type-of x [port]

Print the type of a declared symbol to the given port.

(vouivre base)

The base module (see the tutorial for how to use it) provides useful partially applicable functions. Their type declaration follows.

(∷ * (0 . (0 . 0)))
(∷ + (0 . (0 . 0)))
(∷ - (0 . (0 . 0)))
(∷ / (0 . (0 . 0)))
(∷ 1+ (0 . 0))
(∷ < (0 . (0 . 0)))
(∷ <= (0 . (0 . 0)))
(∷ = (0 . (0 . 0)))
(∷ > (0 . (0 . 0)))
(∷ >= (0 . (0 . 0)))
(∷ abs (0 . 0))
(∷ acos (0 . 0))
(∷ adot (0 . (0 . (0 . 0))))
(∷ amap2 ((0 . (0 . 0)) . (0 . (0 . 0))))
(∷ angle (0 . 0))
(∷ append (0 . (0 . 0)))
(∷ asin (0 . 0))
(∷ atan (0 . 0))
(∷ boolean? (0 . 0))
(∷ caaaar (0 . 0))
(∷ caaadr (0 . 0))
(∷ caaar (0 . 0))
(∷ caadar (0 . 0))
(∷ caaddr (0 . 0))
(∷ caar (0 . 0))
(∷ cadaar (0 . 0))
(∷ cadadr (0 . 0))
(∷ cadar (0 . 0))
(∷ caddar (0 . 0))
(∷ cadddr (0 . 0))
(∷ caddr (0 . 0))
(∷ cadr (0 . 0))
(∷ car (0 . 0))
(∷ cdaaar (0 . 0))
(∷ cdaadr (0 . 0))
(∷ cdaar (0 . 0))
(∷ cdadar (0 . 0))
(∷ cdaddr (0 . 0))
(∷ cdadr (0 . 0))
(∷ cdar (0 . 0))
(∷ cddaar (0 . 0))
(∷ cddadr (0 . 0))
(∷ cddar (0 . 0))
(∷ cdddar (0 . 0))
(∷ cddddr (0 . 0))
(∷ cdddr (0 . 0))
(∷ cddr (0 . 0))
(∷ cdr (0 . 0))
(∷ ceiling (0 . 0))
(∷ char->integer (0 . 0))
(∷ char<=? (0 . (0 . 0)))
(∷ char<? (0 . (0 . 0)))
(∷ char=? (0 . (0 . 0)))
(∷ char>=? (0 . (0 . 0)))
(∷ char>? (0 . (0 . 0)))
(∷ char? (0 . 0))
(∷ complex? (0 . 0))
(∷ cons (0 . (0 . 0)))
(∷ cos (0 . 0))
(∷ denominator (0 . 0))
(∷ div (0 . (0 . 0)))
(∷ eq? (0 . (0 . 0)))
(∷ equal? (0 . (0 . 0)))
(∷ eqv? (0 . (0 . 0)))
(∷ even? (0 . 0))
(∷ exact-integer-sqrt (0 . 0))
(∷ exact? (0 . 0))
(∷ exp (0 . 0))
(∷ expt (0 . (0 . 0)))
(∷ fdiff ((0 . 0) . (0 . 0)))
(∷ finite? (0 . 0))
(∷ flip ((15 . (16 . 17)) . (16 . (15 . 17))))
(∷ floor (0 . 0))
(∷ fold ((0 . (0 . 0)) . (0 . (0 . 0))))
(∷ fold-right ((0 . (0 . 0)) . (0 . (0 . 0))))
(∷ gcd (0 . (0 . 0)))
(∷ identity (2 . 2))
(∷ imag-part (0 . 0))
(∷ inexact? (0 . 0))
(∷ infinite? (0 . 0))
(∷ integer->char (0 . 0))
(∷ integer-valued? (0 . 0))
(∷ integer? (0 . 0))
(∷ lcm (0 . (0 . 0)))
(∷ length (0 . 0))
(∷ list->string (0 . 0))
(∷ list-ref (0 . (0 . 0)))
(∷ list-tail (0 . (0 . 0)))
(∷ list? (0 . 0))
(∷ log (0 . 0))
(∷ logsumexp (0 . 0))
(∷ magnitude (0 . 0))
(∷ make-polar (0 . (0 . 0)))
(∷ make-rectangular (0 . (0 . 0)))
(∷ make-string (0 . (0 . 0)))
(∷ map ((0 . 0) . (0 . 0)))
(∷ max (0 . (0 . 0)))
(∷ maximum (0 . 0))
(∷ mean (0 . 0))
(∷ min (0 . (0 . 0)))
(∷ mod (0 . (0 . 0)))
(∷ nan? (0 . 0))
(∷ negative? (0 . 0))
(∷ not (0 . 0))
(∷ null? (0 . 0))
(∷ number->string (0 . (0 . 0)))
(∷ number? (0 . 0))
(∷ numerator (0 . 0))
(∷ odd? (0 . 0))
(∷ pair? (0 . 0))
(∷ positive? (0 . 0))
(∷ procedure? (0 . 0))
(∷ rational-valued? (0 . 0))
(∷ rational? (0 . 0))
(∷ rationalize (0 . (0 . 0)))
(∷ rdiff ((0 . 0) . (0 . 0)))
(∷ real-part (0 . 0))
(∷ real-valued? (0 . 0))
(∷ real? (0 . 0))
(∷ reduce ((0 . (0 . 0)) . (0 . 0)))
(∷ reduce-right ((0 . (0 . 0)) . (0 . 0)))
(∷ relu (0 . 0))
(∷ reverse (0 . 0))
(∷ round (0 . 0))
(∷ sin (0 . 0))
(∷ sqrt (0 . 0))
(∷ string->list (0 . (0 . (0 . 0))))
(∷ string->number (0 . (0 . 0)))
(∷ string->symbol (0 . 0))
(∷ string-append (0 . (0 . 0)))
(∷ string-copy (0 . (0 . (0 . 0))))
(∷ string-length (0 . 0))
(∷ string-ref (0 . (0 . 0)))
(∷ string<=? (0 . (0 . 0)))
(∷ string<? (0 . (0 . 0)))
(∷ string=? (0 . (0 . 0)))
(∷ string>=? (0 . (0 . 0)))
(∷ string>? (0 . (0 . 0)))
(∷ string? (0 . 0))
(∷ substring (0 . (0 . (0 . 0))))
(∷ sum (0 . 0))
(∷ symbol->string (0 . 0))
(∷ symbol=? (0 . (0 . 0)))
(∷ symbol? (0 . 0))
(∷ tan (0 . 0))
(∷ truncate (0 . 0))
(∷ zero? (0 . 0))
(∷ ∘ ((6 . 7) . ((8 . 6) . (8 . 7))))
(∷ ⊙ ((9 . 10) . ((10 . 11) . (9 . 11))))