Docs / nablatensor-core / com.nablatensor.engine
final class
AadRecorder
Records one pass of a valuation into an AadTape.
AadTape tape = AadRecorder.record(rec -> {
SDouble s0 = rec.input("S0", 100.0);
SDouble s = s0;
for (int t = 0; t < steps; t++) {
s = s.mul(rec.randn().mul(vol).add(drift).exp());
}
rec.output(s.sub(strike).max(0.0));
});Methods
A differentiable input; its recorded value is the default for a replay.
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.
A uniform draw on [0, 1) that varies per scenario, from the default stream.
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.
Records the single output of this valuation, named "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(ADouble) (which uses the name "value") is allowed as long as the names stay distinct.