Docs / jax4j-core / com.nablatensor.jax4j.engine

final class

AadRecorder

Records one pass of an evaluation into an AadTape.

AadTape tape = AadRecorder.record(rec -> {
  SDouble x = rec.input("x", 2.0);
  rec.output(x.mul(x).add(x.sin()));
});

Methods

static AadTape record(Consumer<AadRecorder> body)
SDouble input(String name, double value)

A differentiable input; its recorded value is the default for a replay.

SDouble constant(double value)
SDouble randn()

A standard normal that varies per scenario, drawn from the default stream. Nothing is drawn while recording: the node only reserves the next slot in the per-scenario random stream, which the replay kernel generates on-device.

SDouble randu()

A uniform draw on [0, 1) that varies per scenario, from the default stream.

RandomStream stream(String name)

An independent named random stream. Draws from a stream are statistically independent of every other stream and of the default one, so a jump-time clock, a low-discrepancy dimension or a second factor can be advanced without perturbing the primary path. stream("default") is the same stream randn() / randu() use.

void output(SDouble value)

Records the single output of this evaluation, named "value".

void output(String name, SDouble value)

Records one of several named outputs. Every reverse sweep over the tape then yields this output's value, its Monte-Carlo standard error and its full input gradient; the names address the rows of AadResult. A name may be recorded only once, and mixing this with output(SDouble) (which uses the name "value") is allowed as long as the names stay distinct.