Docs / nablatensor-core / com.nablatensor.engine

final class

AadResult

The outcome of replaying a compiled tape over a batch of scenarios: for every recorded output, its mean value, the Monte-Carlo standard error of that mean, and the mean adjoint gradient with respect to each differentiable input.

A tape recorded with a single rec.output(...) has one output named "value"; the no-argument value(), standardError(), gradient(String) and gradients() accessors read that primary output (the first one recorded) and are all a single-output caller ever needs. A tape with several rec.output(name, ...) calls carries one value / stderr / gradient row per name, addressable through the (output, input) overloads.

standardError is NaN when the producing engine does not yet estimate it.

Constructors

AadResult(double value, double[] gradients, List<String> inputNames, long paths, double seconds)

Single-output result without a standard-error estimate.

AadResult(double value, double standardError, double[] gradients, List<String> inputNames, long paths, double seconds)

Single-output result, output named "value".

Methods

static AadResult of(List<String> outputNames, double[] values, double[] standardErrors, double[][] gradients, List<String> inputNames, long paths, double seconds)

Multi-output result. values, standardErrors and gradients are indexed by the position of a name in outputNames; each gradients[o] is indexed like inputNames.

double value()

Mean value of the primary (first-recorded) output.

double standardError()

Monte-Carlo standard error of value(), or NaN if not estimated.

double[] gradients()

Mean adjoint of the primary output with respect to each input, input order.

double gradient(String inputName)

Mean adjoint of the primary output with respect to one named input.

List<String> outputNames()

The recorded output names, in recording order.

int outputCount()
double value(String outputName)
double standardError(String outputName)
double gradient(String outputName, String inputName)

d(output) / d(input).

Map<String, Double> gradients(String outputName)

The full gradient row for one output, as an ordered input -> adjoint map.

List<String> inputNames()
long paths()
double seconds()
double pathsPerSecond()
String toString()