EML-NOVA · Primitives

What the graphs are made of.

Every library function is composed from these primitives. The last column counts the functions that use each one directly.

PrimitiveWhat it doesInputsDifferentiableUsed by
ConstantA literal value inside the graph.0yes4
AddElementwise sum, NumPy-style broadcasting.2yes7
SubtractElementwise difference, broadcasting.2yes11
MultiplyElementwise product, broadcasting.2yes18
DivideElementwise quotient, broadcasting.2yes3
NegateElementwise negation.1yes2
MatMulMatrix product over the last two axes; leading axes broadcast.2yes6
TransposePermute the axes.1yes3
ReshapeSame elements, new shape; one −1 is inferred.1yes4
ReduceSumSum along one axis, or over everything.1yes4
MeanMean along one axis, or over everything.1yes7
Relumax(x, 0), elementwise.1yes4
Sigmoid1 / (1 + e⁻ˣ), elementwise.1yes1
TanhHyperbolic tangent, elementwise.1yes1
SoftmaxNormalised exponentials along one axis.1yes1
IdentityPass a value through unchanged.1yes—
StopGradientIdentity going forward, zero gradient going back.1yes—
IfChoose between two values by a scalar condition.3not yet—
BoundedLoopA loop with a fixed bound; for now its body is one elementwise operation.1not yet—
CallCall another graph of the same module. This is how the library composes.anynot yet11
Planned

The next primitives

Standard mathematics only. Each line lists what it unlocks.

  1. L1
    Sqrt, Exp, Log

    Elementwise square root, exponential and logarithm.

    Unlocks: norm, std, logsumexp, log_softmax, entropy, softplus, 1/√d in attention

  2. L1
    Maximum, Minimum

    Exact elementwise max and min (a + relu(b − a) is not exact in floating point).

    Unlocks: clip, relu6, hard_sigmoid, huber

  3. L1
    Less, Greater, Equal, Where

    Elementwise comparison and selection.

    Unlocks: masks, piecewise functions, sign

  4. L1
    ReduceMax, ReduceMin

    Largest and smallest value along an axis.

    Unlocks: stable logsumexp, max pooling, argmax (with Where)

  5. L1
    Size

    The element count of a symbolic dimension, as a value.

    Unlocks: sample variance and covariance (n − 1), covariance matrix

  6. L1
    Differentiation through Call

    Reverse-mode AD that follows Call into the callee; today composed entries are not differentiable.

    Unlocks: gradients of every composed entry (mlp2, bilinear, …)

  7. L2
    Slice, Concat, Gather

    Indexing and joining along an axis.

    Unlocks: finite differences, trapezoid rule, convolution, polygon area

  8. L2
    Scan

    A general loop whose body is a graph.

    Unlocks: iterative solvers, recurrences, cumulative sums