Docs / nablatensor-core / com.nablatensor.engine

final class

AadTotals

Per-worker running sums for a host replay: for each recorded output the sum of its value over scenarios, the sum of its square, and the sum of its adjoint with respect to each differentiable input.

One instance per worker thread, combined with add once the workers are done and turned into means, a Monte-Carlo standard error and mean gradients by toResult. Keeping the sums here — rather than a copy of the same three arrays inside every engine — is what lets the scalar, the generated-bytecode and the vector sweeps all report a standard error from one piece of code.

Public only so the engine modules can use it; not part of the supported API.

Constructors

AadTotals(int outputs, int inputs)

Fields

final double[] value

Per output: sum over scenarios of the output value.

final double[] sumsq

Per output: sum over scenarios of the output value squared.

final double[][] gradient

[output][input]: sum over scenarios of the adjoint.

Methods

void add(AadTotals other)
AadResult toResult(AadTape tape, long paths, double seconds)

The sums divided down into a result: mean value, the standard error of that mean, and the mean adjoint per input. The variance uses the raw sum-of-squares form, which is what a per-worker sum can carry cheaply.