All examples
Neural networks

Stream explicit GRU state

Carry detached recurrent state across chunks and perform explicit truncated backpropagation updates.

recurrent_streaming.aner
// Explicit state creates a detached graph boundary for streaming and TBPTT.
import aner.nn
import aner.tensor

let x = tensor.reshape(nn.random(2, 4, seed: 7, scale: 0.2), List(2, 4, 1))
let y = nn.zeros(2, 1)
let model = nn.gru(1, 8).on("cpu")
let start = model.initial_state(batch: 2)
let first = model.step(x, start, lengths: List(4, 2))
let next = model.step(x, first.state())
print(next.values().rows())
let fitted = model.fit_chunk(x, y, start, rate: 0.001, clip_norm: 1.0)
let continued = fitted.fit_chunk(x, y, fitted.state())
print(continued.updates())
// Keep stream identity/order stable across chunks. Reset at series boundaries.

Make it your experiment.

With Aner 0.0.3 or newer installed, save this program as examples/recurrent_streaming.aner inside a folder for your experiment. Open a terminal in that folder, then check and run the program.

Terminal
aner check examples/recurrent_streaming.aner
aner run examples/recurrent_streaming.aner

The aner command must be on your PATH. Follow the installation guide if your terminal cannot find it.

Requires the matching neural development runtime and editor; published 0.0.3 packages predate these APIs. Uses synthetic tensors with no external dataset, credentials or network connection. Optional CUDA/MPS placement requires a compatible native build and hardware.

Credential setup
aner check examples/recurrent_streaming.aner
aner examples/recurrent_streaming.aner

Bundled datasets retain their own source attribution and license notices. Example outcomes are not comparative benchmarks or evidence of clinical validity.

Dataset sources & attribution
Install Aner