Machine learning
Root modules, optimizers, training values, and the FnAutograd, FnLoss, FnMetric, and FnRl operation families.
Examples
Ml
Functions
Classes
2 members
environment-neutral discrete actor/critic contract. Custom policies only need to implement evaluate; PPO collection, loss construction and updates do not depend on the concrete network architecture.
Inherits public Module
Source8 members
─── Adam ────────────────────────────────────────────────────────────────────
Inherits public Optimizer
Source9 members
─── AdamW ─────────────────────────────────────────────────────────────────── Decoupled weight decay — preferred for transformers.
Inherits public Optimizer
2 members
0 members
9 members
─── BpeTokenizer ──────────────────────────────────────────────────────────── Learns byte pair merges to build vocabulary from 256 base bytes to target size. Useful for compressing sequences and improving model efficiency.
3 members
BYTE EMBEDDING - The 256-entry lookup table Maps each byte value (0-255) to a d_model dimensional vector. input: [batch, seq_len] of UInt8 output: [batch, seq_len, d_model] of Float32 This replaces the massive 30k-100k token embedding tables in GPT/LLaMA. Ours is always 256 x d_model. Tiny. Fast. Universal.
Inherits public Module
Source8 members
2 members
BYTE OUTPUT HEAD - convert hidden states back to byte probabilities input: [batch, seq_len, d_model] output: [batch, seq_len, 256] (logits over byte values)
Inherits public Module
Source3 members
Compact default MLP used by discrete-control PPO. It is a convenience model, not a restriction: callers can supply any ActorCritic implementation.
Inherits public ActorCritic · public Module
Source0 members
6 members
─── oa::CbCheckpoint ─────────────────────────────────────────────────────── keras modelCheckpoint(save_freq="epoch") + EarlyStopping's restore_best_weights, on top of oa::CheckpointManager. Every epoch end writes a resumable rotating checkpoint. Pass SaveEvery > 0 to add mid-epoch checkpoints every N completed optimizer steps. The master model is updated only on improvement. at each epoch end it prints a TF-style mini summary: epoch 3: cross_entropy improved from 0.4056 to 0.3486 — saving model epoch 4: cross_entropy did not improve from 0.3486 at train end, if RestoreBest is set and the best epoch wasn't the last one, the best checkpoint is loaded back into model + optimizer — you always walk away with the best weights, not whatever the final (possibly degraded) epoch produced. Monitored value: inMetric->result() when provided (e.g. a val_loss metric), otherwise the epoch mean train loss. Better/worse direction comes from the manager's lowerIsBetter config.
Inherits public CbTraining · public Callback
Source6 members
─── oa::CsvLoggerCallback ────────────────────────────────────────────────── Appends one exact row per completed optimizer step. Rate columns use explicit units; there is no logging cadence hidden inside the metric lifecycle.
Inherits public CbTraining · public Callback
Source2 members
─── oa::LrSchedulerCallback ──────────────────────────────────────────────── Applies any oa::LRScheduler to the optimizer at each step. Use oa::CosineScheduler, oa::OneCycleScheduler, oa::WarmupScheduler, etc. from <oa /ml/optim.h>.
Inherits public CbTraining · public Callback
Source5 members
─── oa::CbPhase ───────────────────────────────────────────────────────────── Multi-phase training callback. phases are consecutive ranges of epochs — build the iterator with oa::ItTrainingConfig::epochSteps so epoch boundaries follow the phase schedule, then register one addPhase() per phase in order. Prints a schedule preview at train begin and a phase banner + phase-relative epoch headers (disable the progress bar's own header via SetShowEpochHeader): phase schedule: 1. warmup — 1 epoch (2000 steps) 2. main — 10 epochs (20000 steps) phase 1/2 — warmup · 1 epoch × 2000 steps epoch 1/1 2000/2000 |██████████| ... The OnPhaseBegin hook fires on entering each phase (including the first) — use it to swap LR schedulers, change datasets, etc.
Inherits public CbTraining · public Callback
Source8 members
─── oa::CbProgressBar ────────────────────────────────────────────────────── tqdm/keras-hybrid progress bar with `█`+`░` and rolling metrics: epoch 1/5 938/938 |██████████| 0.65s · 0.7 ms/step · 1.26M sample/s · accuracy: 0.9091 · loss: 0.2914 epoch 2/5 938/938 |██████████| 0.59s · 0.6 ms/step · 1.31M sample/s · accuracy: 0.9134 · loss: 0.1822 mid-epoch: 468/938 |█████░░░░░| 0.32s · 0.7 ms/step · 1.25M sample/s · loss: 0.3128 Per-step updates rewrite the same line via ` `; epoch end leaves the final line and starts a new one. Uses lastLoss() so per- step refresh never forces a Sync. Accuracy comes from recordAccuracy(); if the caller hasn't set it (NaN), the field is omitted. Wall time per step and workload throughput are shown instead of GPU time. Latency and rates are derived from the iterator's single workload definition; they are not metrics that callers must register separately.
Inherits public CbTraining · public Callback
4 members
─── oa::CbSummary ───────────────────────────────────────────────────────── Prints a final training summary at onTrainEnd: loss, wall latency/throughput, GPU mean/p50/p95, the wall-to-GPU timing gap, and total duration. Optionally tracks initial loss for comparison. example output: summary: loss: initial 2.6558 · final 0.2965 · mean 0.4812 Wall: 0.07 ms/step · 943.68K sample/s · 60.40M token/s GPU: mean 0.051 ms/step · p50 0.049 · p95 0.061 · 1.26M sample/s run: 0.32s · 4686 steps · batch 64 · sequence 64 token/sample
Inherits public CbTraining · public Callback
Source7 members
─── CbTraining ────────────────────────────────────────────────────────────── training-specific callback base class. Subclass and attach via addCallback(). All hooks have default no-op implementations.
Inherits public Callback
Source8 members
Inherits public CbTraining · public Callback
Source0 members
11 members
Restore weights and optimizer state into an already-constructed model/optimizer. Symmetric with maybeSave.
0 members
CheckpointManager — auto-save best models with rotation. Wraps Module::save/load to manage directory structure, path naming, metric tracking, and incremental-checkpoint rotation.
Source1 members
Diagonal Gaussian transformed through tanh into a bounded action interval. rawAction is retained because it is the numerically stable carrier for PPO re-evaluation; action is the value passed to the environment.
Source5 members
0 members
0 members
2 members
ConvTranspose1d: 1D transposed convolution (learnable upsampling); adjoint of Conv1d, no bias.
Inherits public Module
Source2 members
ConvTranspose2d: 2D transposed convolution layer (learnable upsampling).
Inherits public Module
Source0 members
2 members
─── CosineScheduler ───────────────────────────────────────────────────────── Cosine annealing from maxLr to minLr over totalSteps.
Inherits public LRScheduler
Source2 members
─── CosineWarmRestartsScheduler ───────────────────────────────────────────── SGDR: cosine annealing with periodic warm restarts. Period starts at t0 steps, multiplied by tMult after each restart.
Inherits public LRScheduler
Source0 members
10 members
Environment-neutral DQN update coordinator over caller-owned online and target modules, optimizer, and replay storage. It composes `ItTraining` for the exact optimizer lifecycle; it does not inherit a nominal trainer base.
Source0 members
0 members
2 members
Dropout module. training applies inverted dropout; evaluation is identity.
Inherits public Module
Source8 members
EmpyrealmCore — empyrealm-style sequential modeling core. high-utilization reusable backbone: input projection (byte embed or custom) → mixer + flat per-token residual → mixed features [B*seq, dModel]. The mixer is EmpyrealmModule, which dispatches empyrealm* kernels (EmpyrealmDt, EmpyrealmAdt, EmpyrealmSiso) — renamed copies of the Mamba3* kernels with identical SPIR-V today, ready for future architecture-specific divergence. shader layout (for fusion / branding): Ssm/Mamba3/ — original Mamba3Siso* (untouched reference, used by Mamba3Module) Ssm/empyrealm/ — ported/copied starting point; will host fused empyrealm* variants (e.g. custom one-node mixers) while Mamba3 stays pristine. The reconstruction tutorial demonstrates the intended usage. Brand Mamba3 tech as empyrealm for custom evolution.
Inherits public Module
Embedded-only constructor. No embed module is created or registered, so no dead/zero-gradient embed params leak into allParameterPtrs(), the optimizer, or checkpoints. The caller must feed pre-embedded [B, S, D] features via forwardEmbedded(); forward() is unavailable in this mode and asserts. Used by specializations that own their own input projection.
Byte/token constructor. forward expects [B, seq] uint8/index matrix. Creates internal oa::Embedding.
General constructor for specialization. Pass custom projection (e.g. oa::Linear(poseDim, dModel) for motion features). The module must output [B, seq, dModel] (or compatible with ForwardEmbedded).
0 members
tag type selecting the embedded-only EmpyrealmCore constructor (no embed module is created or registered; the caller drives the mixer via ForwardEmbedded with its own [B, S, D] features). Disambiguates from the byte ctor, whose two leading ints would otherwise collide.
Source17 members
Stateful native environment session. The session borrows one Engine and privately owns its recorder/execution state. reset/step remain stateful commands; submit returns the exact completion for every command recorded since the previous completion. The public boundary never exposes context or queue controls.
begin is idempotent while recording. recordCommands selects the owned execution session only for the callback's dynamic extent, so ambient context state is restored even on failure. A callback failure cancels the whole unsubmitted transaction.
cancel discards only unsubmitted commands. close completes an already submitted event, discards unsubmitted commands, and is idempotent.
7 members
4 members
One single-agent environment schema. It is intentionally a value contract, not a virtual environment hierarchy: native GPU environments and Python adapters can expose the same metadata without sharing execution machinery.
Source8 members
0 members
2 members
0 members
Modality-independent flow denoiser. Image patches and motion frames use the same token contract; callers choose inputDim, sequence length and optional condition features. numExperts selects dense or shared dropless-MoE FFNs.
Source0 members
Linear flow-matching state and its constant path velocity. Both matrices remain on the active OA device and participate in the normal autograd graph.
Source5 members
GPU sinusoidal embedding for normalized continuous time. Only the small, deterministic frequency vector is uploaded at construction; every batch is embedded by OA matrix kernels without a tensor-sized CPU loop or readback.
Inherits public Module
Source10 members
Reusable bidirectional Transformer backbone for flow/diffusion denoisers. input is conditioned token state [B,S,D] or flattened [B*S,D]; output keeps the same shape. This is a sibling model family that composes generic Transformer blocks; it is not part of the generic Transformer itself.
Inherits public Module
Source0 members
Configuration for a bidirectional denoising Transformer. numExperts == 0 selects an ordinary dense FFN; a positive value selects the shared dropless MoE implementation without changing the model's input/output contract.
Source0 members
0 members
5 members
oa::GradientTape — RAII scope guard that enables autograd for its lifetime. call backward() to execute the recorded backward graph.
8 members
Inherits public Module
split projections so Gru can hoist the (recurrence-free) input projection out of the timestep loop into one batched GEMM. inputProjection: gatesI = Linear(x, W_ih, b_ih) for any row count → [*, 3H]. stepWithGatesI: consumes a precomputed gatesI [B*T, 3H] at row offset timeOffset and runs only the recurrent gatesH + pointwise.
0 members
0 members
0 members
16 members
Coordinates the two-phase lifecycle of synchronous on-policy training. Environment stepping, policy evaluation, and loss construction remain caller supplied; an owned `ItTraining` controls each exact optimizer update.
Restores the pre-beginRollout collect state after the caller cancels the unsubmitted command transaction. This is also valid after finalizeRollout and before the first update begins.
Must be called immediately before recording one differentiable PPO update. It advances the underlying ItTraining lifecycle and returns false only on invalid phase/configuration or after completion.
0 members
60 members
0 members
0 members
2 members
─── LinearWarmupCosineScheduler ───────────────────────────────────────────── Convenience scheduler: linear warmup to targetLr, then cosine annealing to minLr. Composes WarmupScheduler + CosineScheduler.
Inherits public LRScheduler
Source3 members
─── LRScheduler (base) ──────────────────────────────────────────────────────
Source22 members
Mamba3Module — Mamba-3 selective state space model block Reference: Mamba-3 paper (https://arxiv.org/abs/2603.15569) Based on: https://github.com/state-spaces/mamba (mamba_ssm/modules/mamba3.py)
Inherits public Module
0 members
0 members
8 members
─── Metric ────────────────────────────────────────────────────────────────── base class for all metrics. Follows the keras pattern: - update(): add a new batch of predictions/labels - reset(): clear accumulated state - result(): get the current metric value
7 members
─── MetricAccuracy ──────────────────────────────────────────────────────────
Inherits public Metric
Source13 members
─── MetricLoss ──────────────────────────────────────────────────────────────
Inherits public Metric
Source14 members
A complete OA model file loaded in memory. `ModelFile` owns model configuration, named weights, persistent state, optimizer state, and training progress. `load()` and `save()` implement the native `.oam` wire format. External formats are imported by `oa::ModelTranslator`; they are not alternative representations of this type.
upload one encoded weight as the same semantic value consumed by the fused vkDNN MatMulNt path. Dense entries fail closed.
0 members
Generic config — universal fields that every architecture has. architecture-specific config follows immediately after (archConfigSize bytes).
Source0 members
0 members
0 members
0 members
0 members
3 members
Model translators are small declarative mapping layers. They inspect the opened source/config assets and emit a complete map; transfer mechanics remain shared and independently tested.
Source29 members
oa::Module — base class for all neural network modules.
persistent/non-trainable state. buffers never receive gradients and never participate in optimizer parameter traversal or numParameters().
Parameter management WARNING: parameters() returns ONLY direct parameters (non-recursive), unlike PyTorch's .parameters(). For nested modules use allParameterPtrs() instead. FOOTGUN: module->parameters()[0] on a nested module is OOB. Always check .size() first or use allParameterPtrs().
Persistence — non-virtual generic tree walks. Builds dotted parameter paths from registerModule/registerParameter names (e.g. "fc1.weight"). arch-specific loaders (SafeTensors, sharded LLM weights) live as separate helper fns that write into an already-constructed module. Optimizer overloads bundle state into the same .oam file so resume training is one call per side.
20 members
Inherits public Module
── Optional differentiable balancing losses (opt-in, default off) ───────── Switch/GShard aux loss α·E·Σ_e f_e·p_e (f = hard load fraction, constant; P = mean router prob, differentiable) plus router z-loss β·mean(LSE²). Add auxLoss() to the task loss before backward. Both coefficients 0 ⇒ auxLoss() is a 0 scalar recorded on the tape with no gradient effect.
── Aux-loss-free load balancing (DeepSeek-V3) ───────────────────────────── A per-expert bias added to the routing logits for the top-k SELECTION decision only (never into the gate magnitude, so it does not distort the weighted combine and produces no gradient). After each optimizer step, call updateRoutingBias() to nudge under-loaded experts up and over-loaded ones down. The update and next forward remain in the deferred GPU graph.
0 members
route-utilization telemetry from the last forward. Read after execute+Sync, exactly like lastSelectionMask(). This is the instrument that makes expert collapse observable — with no balancing, a MoE can silently route everything to one expert (harmless while the oracle runs every expert densely, fatal the moment the sparse executor lands).
Source11 members
MultiHeadAttention: Multi-head scaled dot-product self-attention with explicit causal/bidirectional visibility and interchangeable standard/fused causal Flash backends.
Inherits public Module
Source8 members
─── Muon ──────────────────────────────────────────────────────────────────── GPU momentum + Newton-Schulz5 orthogonalization optimizer. https://github.com/KellerJordan/Muon + https://arxiv.org/abs/2502.16982 Rank-2 parameters use the orthogonalized Muon update. Other ranks use the optimizer's fused GPU momentum update. Muon owns exactly the parameter set supplied by the caller and never delegates to another optimizer.
Inherits public Optimizer
Source8 members
Ready-to-train causal language model: token + position embeddings, a stack of Transformer blocks, final normalization, and vocabulary projection. Input token ids are [batch, contextLength]; logits are [batch*contextLength, vocabSize] for all-position next-token training.
Inherits public Module
Source2 members
─── OneCycleScheduler ─────────────────────────────────────────────────────── Smith's 1cycle policy: warmup ramp to maxLr, then cosine anneal to near-zero. initialLr = maxLr/divFactor. finalLr = initialLr/finalDivFactor.
Inherits public LRScheduler
Source11 members
─── base Optimizer ──────────────────────────────────────────────────────────
A compiled training program executes the already-recorded optimizer kernels without calling step() again. Keep the host-visible logical step aligned so schedules and checkpoints observe the same state as eager execution.
0 members
OPTIMIZER CONFIG — AdamW, SGD, schedulers
Source3 members
─── No-op optimizer ───────────────────────────────────────────────────────── For callers that pass an Optimizer & but update params themselves (e.g. hand-rolled training tutorials using ItTraining purely for cadence + callbacks).
Inherits public Optimizer
Source2 members
oa::Parameter — named trainable tensor with live gradient access.
Gradient — SINGLE SOURCE OF TRUTH. The grad buffer is owned by data's autograd meta (allocated lazily by setRequiresGrad / accumulateGrad). grad() resolves to that live buffer every call, so it can never be a stale snapshot. - non-const grad() → mutable lvalue ref to the live grad (fill / assign / & ). - const grad() → by-value handle sharing the live buffer (read-only).
0 members
0 members
0 members
2 members
Deterministic categorical evaluation over any native OA vector environment. Evaluation is an explicit telemetry boundary: it records the entire horizon first, then performs one execution/synchronization and three compact readbacks.
Source0 members
19 members
Complete environment-neutral categorical PPO loop. The environment remains caller-owned; this class owns collection storage, policy bookkeeping, GAE, and optimizer updates. It composes `ItRolloutTraining` because collection and update phases are not the same lifecycle as DQN or SAC.
Rolls back collection control state after the caller cancels the unsubmitted command transaction. valid from beginCollection through endCollection, until the first update actually begins.
0 members
0 members
0 members
in_proj split + RMSNorm/discretization shared by forward and step.
Source8 members
A GPU-resident weight stored in OA's native Q4 or Q8 block encoding. Quantization is deliberately not an `oa::ScalarType`: one logical value owns a packed integer payload and a separate Float32 scale plane. Treating Q4 as a scalar dtype would make matrix byte sizes, strides, views, and element access incorrect. The physical planes remain private and travel as one weight value.
Source10 members
Preallocated circular off-policy storage. Appends and deterministic uniform sampling stay on the GPU; size/cursor are host control metadata and never depend on a tensor readback.
Source0 members
0 members
9 members
Inherits public Module
Per-level EMA codebook update; call once per step AFTER the optimizer step with the result returned by this step's quantize().
Token → latent: sum each level's gathered code vectors. The inference-time inverse of quantize for the SUMMED RVQ output — pass per-level generated token ids (one [N] Int32 per level, shallow→deep) → z_q [N, D] for the decoder. inIdx may carry fewer than numLevels() levels (e.g. a model that only generates level 0); only the supplied levels are summed.
z_e [N, D] → straight-through total quantization + per-level tokens + per-level residuals (kept for emaUpdate) + commitment loss. Records entirely on-GPU.
0 members
─── residual Vector quantizer (RVQ) ──────────────────────────────────────── Stacks Q VectorQuantizer levels: level 0 quantizes z_e, level q quantizes the residual left by levels 0..q-1. The quantized output is the SUM of all levels' codes, so Q tokens per frame give far finer reconstruction than one (K^Q effective codes) — the basis for MoMask / MotionDreamer residual-token generation, where a masked model later predicts these per-level tokens. Each level keeps its own EMA codebook; the straight-through estimate and commitment loss apply once on the total.
Source0 members
0 members
8 members
RnnCell / Rnn — vanilla Elman recurrent module. h_new = tanh( W_ih x + b_ih + W_hh h + b_hh ) Mirrors the Gru / GruCell API 1:1 (zeroState / step / forward, stacked layers) so the two recurrent modules are interchangeable in a model. Like the GRU it fuses its pointwise tail (Add + Tanh) into one RnnCellPointwise kernel. The two Linear projections stay separate dispatches; since oa::FnMatrix::Linear is pure dispatch, each needs a manual grad-node attach — see AttachLinearGrad in Rnn.cpp.
Inherits public Module
split projections so Rnn can hoist the (recurrence-free) input projection out of the timestep loop into one batched GEMM. inputProjection: gi = Linear(x, W_ih, b_ih) for any row count → [*, H]. stepWithGi: consumes a precomputed gi [B*T, H] at row offset timeOffset and runs only the recurrent gh = Linear(h, W_hh) + fused tanh pointwise (no per-step Slice).
0 members
0 members
0 members
1 members
time-major PPO carrier. reshape the leading [time, environments] dimensions to create minibatch views without copying storage.
Source12 members
Records one fused GPU append. The CPU cursor is control metadata only; no matrix data is read or copied through the host.
Requires a complete rollout and records GAE directly into the preallocated advantage/return matrices.
3 members
Same-device categorical collector. It owns no environment, network or storage; collect records one complete rollout transaction and returns its exact completion event without waiting.
Source0 members
0 members
0 members
Fixed-shape categorical on-policy rollout storage. observationShape excludes the environment axis; for CartPole it is {4}.
Source0 members
One vector-environment transition. Every matrix remains device-resident.
Source2 members
Rotary position embedding over a flattened [tokens, heads * head_dim] input.
Inherits public Module
Source0 members
10 members
Minimal fixed-alpha SAC trainer. Actor forward returns [B, 2*A] containing mean then log-standard-deviation; each critic consumes [observation, action] concatenated on the last axis and returns [B] or [B,1]. Its independent actor and critic update loops are composed rather than hidden by inheritance.
0 members
0 members
2 members
5 members
2 members
─── SequentialScheduler ───────────────────────────────────────────────────── Chain N schedulers at milestones. milestones[i] = step at which scheduler i+1 starts. Each sub-scheduler receives step relative to its own start.
Inherits public LRScheduler
Source8 members
─── SGD ─────────────────────────────────────────────────────────────────────
Inherits public Optimizer
Source2 members
0 members
1 members
BASE TRAINING CONFIG — Shared across LLM, RL, GAN, etc.
Source0 members
0 members
0 members
Stable, deterministic evidence for the current training-plan capture seam. `Inherited` means the decision still happened in the compatibility authoring or lowering path rather than in a unified graph compiler. `NotRun` is not a success: it makes an intentionally missing optimization visible.
Source0 members
0 members
25 members
compile the engine's currently recorded fixed-shape step. On success the source graph is cleared without execution and this program becomes its sole executable owner. On failure the source graph is left intact so the caller may execute it eagerly or diagnose the rejected node. The engine and its vulkan device must outlive this program.
0 members
26 members
Atomically combines the live state/revision with the most recently published step metrics. Unlike latestSnapshot(), this reflects commands applied since the last completed training step.
Called by oa::ItTraining after a completed step/reset/finish. Public for custom iterator adapters, but ordinary callers do not invoke these.
Non-destructive bounded result view for independent observers such as a viewer and MCP client. results older than the configured ring capacity may have been dropped; callers advance their own sequence cursor.
Non-blocking safe point for UI/event-loop owned training. Returns true only when one ordinary training step may begin now.
0 members
0 members
0 members
0 members
TRAINING PHASE CONFIG — Multi-phase training schedule
Source23 members
Inherits public Module
Enables DiT-style AdaLN-Zero modulation. The ordinary language-model path remains unchanged until this is explicitly enabled by a conditioned model.
forward: x [B*S, D] → [B*S, D]. inSeqLen separates sequences within the flattened batch. Causal visibility remains the language-model default; flow/denoising encoders explicitly select Bidirectional.
Same block with an explicit additive attention mask [B*H*S,S]. The mask is shared by language padding and bidirectional denoising; Flash attention is intentionally bypassed because its current kernel is causal-only.
2 members
0 members
─── oa::CbValidation ─────────────────────────────────────────────────────── Runs inference-only validation after every epoch. step-only runs can provide an interval and are always evaluated once at train end. The evaluator owns batching/model semantics and returns the sample-weighted mean loss. Validation time is excluded from training throughput and printed separately. register this callback before checkpoint and early-stopping callbacks, then pass metricPtr() to both.
Source10 members
Inherits public Module
EMA codebook update + dead-code reinit. call ONCE per step AFTER the optimizer step, with this step's z_e and the idx returned by quantize(). in-place on the codebook buffer (so it stays the same checkpointed buffers() entry).
Token → latent: gather the code vectors for the given indices ([N] Int32, the dtype VqAssign emits, or any generated ids). The inference-time inverse of the nearest-code assignment — feed generated token ids straight back through it to reconstruct z_q [N, D] for the decoder. Pure lookup, no STE.
z_e [N, D] (RMS-normalized latents recommended) → quantized (STE) + code indices + commitment loss. Records entirely on-GPU.
Data-dependent init: seed the K codes from the K HIGHEST-NORM rows of inLatents ([>= K, D] encoder outputs) — NOT the first K, which is degenerate for residual VQ (rows a shallow level used → ~zero residual → a deeper codebook seeds all zeros and dies). Highest-norm rows are never zero, so every level gets live, distinct codes. writes the codebook IN-PLACE (copyFrom) so the registered buffers() entry stays valid. Completes inLatents before reading.
0 members
0 members
0 members
0 members
VRAM BUDGET — auto-tune batch_size * seq_len from free VRAM (implementation in budget.cpp)
Source0 members
2 members
─── WarmupScheduler ───────────────────────────────────────────────────────── Linear warmup to targetLr over warmupSteps, then delegate to after scheduler.
Inherits public LRScheduler
Source0 members
0 members
0 members
0 members
10 members
Immutable named-weight source. Implementations may mmap one file, aggregate a sharded manifest, or expose another model container. Returned byte spans remain valid while the source remains alive.
0 members
Enums
None · Relu · Gelu · Silu
Execution policy for scaled dot-product attention. Auto selects only an internally proven route and otherwise preserves the compositional reference path; Flash explicitly requests the fused causal implementation.
Auto · Standard · Flash
─── CyclicScheduler ───────────────────────────────────────────────────────── Cyclic LR: oscillates between baseLr and maxLr. Triangular = constant amplitude. Triangular2 = halving amplitude per cycle. ExpRange = exponential decay per iteration.
Triangular · Triangular2 · ExpRange
─── oa::CbEarlyStop ──────────────────────────────────────────────────────── keras EarlyStopping. calls iter.requestStop() once the monitored value has not improved for `patience` epochs — the training while-loop exits on the next isDone(). Pair with oa::CbCheckpoint(RestoreBest) to also get restore_best_weights semantics. Patience: number of epochs without improvement to tolerate. MinDelta: minimum change to count as improvement. Mode: Min for loss (lower is better), Max for accuracy (higher is better). If inMetric is provided, uses that metric's value; otherwise epoch mean loss.
Min · Max
Structural domains shared by native OA environments and interoperability adapters. Shapes exclude the leading environment-batch dimension; rank zero therefore represents one scalar per environment.
Box · Discrete · Binary
Mean · Last
Config · Weights · State · Optimizer · Progress · LegacyKernelCache
Dense · Q4 · Q8
─── ReduceOnPlateauScheduler ──────────────────────────────────────────────── Metric-driven: drop LR by factor when metric stalls for patience steps. call step(metric) each epoch. getLr() returns current LR (ignores inStep).
Min · Max
Q4 · Q8
Collect · Update · Complete
Applied · Rejected
Pause · Resume · Stop · Checkpoint · Evaluate · SetParameter · RequestRecapture · RequestRebuild
SemanticValidation · ReplaySafety · Decomposition · Fusion · Placement · Precision · KernelSelection · LoweringValidation · MemoryPlanning · SynchronizationPlanning · CommandRecording
NotRun · Inherited · Analyzed · Applied · Failed
Hot · Recapture · Rebuild · Immutable
Running · Paused · Stopping · Completed · Failed
Empty · Boolean · Integer · Float · String
Nearest · Bilinear
Auto · SafeTensors · ModelFile · Gguf · Onnx
Identity · Transpose2D · Concat · Slice
Functions
Functions
bce: binary cross-entropy. -(b*log(a) + (1-b)*log(1-a)), clamped for stability.
bceBwd: gradient w.r.t. inA: (a-b)/(a*(1-a))/N.
crossEntropy: Mean cross-entropy over rank-two logits and UInt8, UInt32, or non-negative Int32 class-index targets; the scalar result is Float32, and an out-of-range target produces NaN without an out-of-bounds read.
crossEntropyBwd: gradient w.r.t. logits: (softmax(logits) - onehot(targets)) / batch
inLogitsin — [batch, classes] unnormalized logits
inTargetsin — [batch] class indices (UInt8, UInt32, or non-negative Int32)
l1: mean absolute error. mean(|a-b|).
l1Bwd: gradient w.r.t. inA: sign(a-b)/N.
Returns the name of the most recently called loss function, or nullptr.
maskedCrossEntropy: cross-entropy over only rows where inMask is non-zero.
maskedCrossEntropyBwd: backward for maskedCrossEntropy.
mse: mean squared error. mean((a-b)^2).
mseBwd: gradient w.r.t. inA: 2*(a-b)/N.
Internal: called by each loss function to record its name.
smoothL1: smooth L1 / Huber loss (beta=1.0). mean over all elements.
smoothL1Bwd: gradient w.r.t. inA.