Machine learning
Models, autograd, losses, optimizers, metrics, and reinforcement learning.
Examples
Functions
Load a native OA .oam checkpoint into existing matching owners. The complete file, section hashes, tensor metadata, module paths, shapes, dtypes, and optimizer payload are validated before any live handle changes. runtime remains the sole owner of newly uploaded storage. Errors Returns crate::ErrorKind::CheckpointCorrupt for malformed, truncated, or integrity-invalid .oam data. Returns another error for a valid file that does not match the destination model/optimizer, or for allocation/runtime and filesystem failures.
Load a committed run state. Errors Returns an error when the file is missing, unreadable, or fails the magic/version/length contract — callers must not guess at a partial training position.
Save a module and its complete optimizer state in the native OA .oam format. Registration-derived parameter paths become the Weights index. Persistent module buffers become the State index; non-persistent buffers are excluded. This is an explicit host-observation boundary. The completed file is durably written to a sibling temporary path and atomically renamed. Errors Returns an error for ambiguous module ownership, optimizer/model mismatch, unsupported Matrix metadata, readback failure, arithmetic overflow, or a filesystem failure.
Commit a run state atomically: write the complete payload to a sibling temporary file, flush, then rename over path. A crash anywhere before the rename leaves either the previous committed state or nothing — never a truncated run state. Errors Returns an error when serialization, the temporary write, flush, or rename fails.
Types
9 members
Device-resident training accuracy for classification steps. The metric owns a persistent accumulator: each AccuracyObserver::observe call inside the step’s record closure records the correctness count, its cast, and its accumulation — operations that capture into the training program and execute on every replay, so no per-step accuracy readback exists. The single observation is one readback per epoch boundary inside commit_epoch. Epoch isolation is exact cumulative differencing of both the device correct-count and the lifecycle’s exact sample accounting; integer counts in F32 are exact far beyond any training run (2^24 samples), so the counter never resets.
2 members
Cloneable recording handle for one AccuracyMetric. Call AccuracyObserver::observe exactly once per step inside the record closure; in the captured plane the operations record once and execute on every replay, so no per-step accuracy readback exists.
Source3 members
Environment-neutral discrete actor/critic behavior. PPO depends on this contract rather than a concrete network architecture.
Source15 members
Adam optimizer over stable Parameter handles.
Source17 members
15 members
Deterministic byte-pair encoder compatible with OA’s oa_bpe_v1 files.
Source22 members
Default two-tower categorical actor/critic MLP. Policy and value paths are independent Linear -> ReLU -> Linear -> ReLU -> Linear towers, matching OA C++.
12 members
Epoch, interval, best-model, and restore-best checkpoint policy.
Source15 members
Stateful checkpoint selection and bounded incremental-retention policy.
Source0 members
Optimizer with a complete native .oam save-and-restore contract. This capability is sealed because persistence must remain synchronized with OA’s versioned model-file codec. Custom optimizers can implement Optimizer for eager training without claiming wire compatibility.
Source3 members
One metric value committed to the shared training history. Entries are append-only and ordered: the lifecycle commits training epoch metrics before any epoch-end callback fires, so validation, checkpoint monitors, and early stopping read committed training values in the same boundary. Sinks never re-derive a number another sink read — they query the log.
Source8 members
Replayable reset/step/observation contract for one Environment. Implementations must keep every replay-visible piece of episode state in device-resident matrices: the captured plans bind those buffers once and replay the identical command sequence, so no host-computed value may differ across replays. Deterministic per-episode variation belongs in on-device counters (as CartPole’s episode_index does) or in the cursor words above.
Source6 members
Reusable compiled collection owner: captured reset/step/GAE plans plus replay accounting.
Source0 members
One bounded continuous action and its differentiable policy statistics.
Source7 members
Buffered one-row-per-completed-step CSV logger. File creation, writes, and close-time flushing happen only at explicit callback boundaries. Abandoning the callback discards any unflushed host buffer; Drop does not hide an I/O failure.
Source0 members
10 members
Stateful DQN training coordinator over caller-owned components. The online module, target module, optimizer, replay storage, and runtime remain caller-owned and must outlive this coordinator. Dropping the trainer does not submit, wait, synchronize targets, or fire terminal callbacks; use DqnTrainer::finish for the explicit terminal boundary.
Source5 members
Last completed DQN update and its synchronized scalar loss.
Source13 members
4 members
The planes a resolved precision selection actually runs at, as reported against one runtime’s device contract.
Source15 members
Checked shape, dtype, and range contract for one environment field. shape excludes the leading environment-batch dimension. An empty shape therefore represents one scalar per environment.
Source11 members
Complete single-agent environment schema shared by native and adapter paths.
Source6 members
One batched environment step result preserving termination and truncation.
Source3 members
A supervised evaluation summary with optional exact classification counts.
Source5 members
Aggregate device time for completed, timestamped training steps.
Source6 members
Thread-affine reverse-mode recording scope. Constructing a tape selects it for operations on the current thread. GradientTape::backward closes the recording scope and records the corresponding backward operations into the originating runtime’s eager batch.
Source6 members
Applies a learning-rate schedule after every completed optimizer step.
Source11 members
1 members
Registers an explicitly included MCP view over an existing training session. The server borrows session through its handlers and must be closed or destroyed first. oa/ml deliberately does not opt applications into the network control surface. Rebuild and preview remain absent until their checkpoint and completion contracts are admitted. Donor: oa::McpTraining.
Source15 members
Stateful neural-network component with one registered ownership tree.
Source0 members
Private architecture metadata carried by an optimizer-free module artifact.
Source7 members
Constructor-owned structural registry for one Module. Registration requires &mut self, so a module’s parameter/buffer/child tree is fixed before the module is shared through Rc.
Source14 members
Muon optimizer with Nesterov momentum and rank-two NS5 orthogonalization. Rank-two parameters use the donor Muon matrix pipeline. Other ranks use its fused momentum update; OA never silently delegates them to AdamW.
Source2 members
Owned dotted path and host scalar that participates in module persistence. Scalar state is intended for small algorithmic counters and flags whose value affects the next device operation but does not belong in a Matrix buffer. It is traversed and checkpointed with the same deterministic module tree as parameters and buffers.
Source11 members
Optimizer for externally authored parameter updates. NoOpOptimizer lets callers use crate::ml::Training for cadence, metrics, and callbacks while the step body owns all parameter mutation.
Source7 members
One imported ONNX inference graph over device-resident F32 tensors.
Source7 members
Common behavior exposed by an OA optimizer to training policy. This contract deliberately excludes captured-program and persistence internals. Those capabilities depend on optimizer-specific state and are admitted separately only when their complete implementation exists.
Source7 members
Named trainable FP32 matrix with one live accumulated gradient.
Source14 members
Consecutive phase policy over one super::super::Training lifecycle. The phase schedule does not own another iterator. Its epoch/step totals must exactly match the iterator configuration, and its optional transition hook receives restricted mutable access to the iterator’s existing optimizer.
Source24 members
Complete caller-driven categorical PPO lifecycle. The Runtime, model, and optimizer remain caller-owned. The trainer owns only its fixed-capacity rollout and lifecycle state. Drop performs no submission, waiting, or terminal callbacks; call PpoTrainer::finish explicitly.
5 members
Scalar results from the last completed PPO update epoch.
Source6 members
Reusable fixed-geometry PPO backward and AdamW programs. Retain this value across trainers when checkpointing between rollouts. Each minibatch reuses one bounded tape’s storage, accumulating sample-weighted gradients before exactly one AdamW step per epoch. Tail shapes compile once. Drop never submits or waits. Different models/configurations are rejected.
Source7 members
A typed precision request for one training run.
Source9 members
Throttled Keras/tqdm-style wall-throughput progress display.
Source4 members
A GPU-resident weight stored in OA’s native Q4 or Q8 block encoding. Constructed by quantize; the packed payload and scale planes are private implementation detail and never exposed as public matrix values.
Source7 members
Device-resident replay values, optionally including sampled source indices.
Source10 members
Circular fixed-capacity owner for off-policy transitions. Batched append and deterministic uniform sampling are recorded on the one owning runtime. Cursor and size are host control metadata and never require a Matrix readback.
Source8 members
One batch of transitions to append to a ReplayBuffer.
Source11 members
Time-major matrices retained by one RolloutBuffer.
Source11 members
Stateful fixed-capacity owner for one categorical on-policy rollout. Appends, validity reset, and final GAE are recorded on the owning runtime; host observation remains the explicit submit-and-wait boundary. Storage is allocated once and overwritten in place across completed collection cycles.
Source3 members
Environment-neutral categorical collector over borrowed owners. Collection records one complete transaction and returns its exact Event without waiting. It owns no environment, model, rollout storage, Runtime, or queue.
Source14 members
Coordinator for alternating fixed-capacity collection and optimizer phases.
Source10 members
One vector-environment transition whose values remain device-resident.
Source3 members
Exact-resume training-loop position committed at a completed update boundary. epoch and loader_cursor restore the data pass through DataLoader::seek; the scaler fields restore dynamic loss scaling through GradScaler::restore_state. Schedulers are stateless step-to-rate mappings and ride on the logical optimizer step already persisted in .oam. Stochastic stream positions have their own resume contract.
Source10 members
Stateful fixed-temperature SAC coordinator over caller-owned components.
Source5 members
Validated, host-owned SafeTensors source used by explicit model translators.
Source14 members
10 members
Final loss, wall-time, device-time, throughput, and run summary.
Source4 members
Fixed-geometry trading reset, policy/step/append and GAE replay programs. Retain alongside the same environment and PpoUpdateProgram across rollouts. Seven cursor words are uploaded once per chunk and advance on device; tables refresh at explicit completed rollout boundaries. Drop never executes or waits.
Source37 members
Exact eager or captured training-step lifecycle. The loop borrows the runtime, optimizer, metrics, and callbacks. Call Training::begin_step before authoring each body, then finish it with Training::complete_step or Training::complete_program_step. Training::finish is the explicit fallible terminal boundary.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
8 members
Restricted mutable services available to one callback invocation.
Source3 members
One command submitted by a session client.
Source7 members
Immutable evidence for one training-program compilation stage.
Source2 members
Observations for one training epoch, including a partial final epoch.
Source2 members
2 members
Epoch observations and the terminal state of a managed training run.
Source6 members
Stateful metric updated once after each completed step. Snapshot-only loss-style metrics implement the four legacy methods. Prediction metrics need batch tensors the snapshot does not carry: they instead observe batches inside the step’s record closure (AccuracyObserver::observe) and commit their epoch result to the shared history bus through TrainingMetric::commit_epoch. New code should not add snapshot-only metrics; the snapshot path exists for scalars the lifecycle itself produces.
Source19 members
Fixed-shape forward, backward, and AdamW program captured for Vulkan replay. The first capture records semantic work without executing it. Replays use one cached command buffer and graph-resident optimizer state; no forward, autograd, or optimizer graph is rebuilt on the host.
20 members
Cloneable, thread-safe command and observation handle for one training loop. Attach it to exactly one super::Training instance. Clones may enqueue commands and read bounded evidence from UI, viewer, or service threads.
3 members
Bounded live-control snapshot published by an attached iterator.
Source28 members
9 members
Runs application-owned inference validation at completed lifecycle boundaries. Epoch-based training evaluates once at every epoch end. Step-only training evaluates at each non-zero configured interval and once at train end when the final step was not already evaluated. Evaluation wall time is excluded from training throughput and the callback never submits work on its own.
Source4 members
Cloneable observation handle for the latest completed validation loss. Clones share one thread-affine value so checkpoint, summary, and early-stop callbacks can observe the result without owning or rerunning validation.
SourceEnums
OA native block quantization selector. Both formats share one 32-value block layout and one Float32 scale per block. Q4 stores a biased 4-bit index per value (16 bytes per block); Q8 stores one signed byte per value (32 bytes per block).
Q4 · Q8
Kind of command applied at a training safe point.
Pause · Resume · Stop · Checkpoint · Evaluate · SetParameter · RequestRecapture · RequestRebuild
Ordered compilation stage for a captured training program.
SemanticValidation · ReplaySafety · Decomposition · Fusion · Placement · Precision · KernelSelection · LoweringValidation · MemoryPlanning · SynchronizationPlanning · CommandRecording
Outcome of one training-program compilation stage.
NotRun · Inherited · Analyzed · Applied · Failed
Live state of an attached training lifecycle.
Running · Paused · Stopping · Completed · Failed
Typed value carried by a command or exposed parameter.
Empty · Boolean(bool) · Integer(i64) · Float(f64) · String(String)
Functions
Compute generalized advantage estimates over a fixed rollout. Termination disables value bootstrap. Termination and truncation both stop the reverse trace, while truncation deliberately retains one-step bootstrap. Errors Returns an error unless all inputs share one runtime and one nonempty [time, environments] shape, values are F32, boundary masks are U8, both discounts are finite in [0, 1], and GPU recording succeeds.
Record generalized advantage estimation into caller-owned output storage. This is the allocation-free form used by fixed-capacity rollout storage. It has the same semantic identity and numerical contract as gae. Errors Returns the errors from gae, and rejects output matrices that do not match the rollout’s runtime, F32 dtype, and shape or alias any input/each other.
Standardize a nonempty FP32 advantage tensor over all elements. The result is (advantage - mean) / sqrt(variance + epsilon). The operation remains device-resident and differentiable, and records one semantic identity over its composite Matrix lowering. Errors Returns an error when advantage is empty or not FP32, epsilon is not positive and finite, a size exceeds the admitted shader ABI, allocation fails, or composite lowering fails.
Types
Functions
Greedily decode one byte from each FP32 logit row. This is an explicit submission, completion, and compact host-read boundary. Errors Returns an error unless logits are rank-one [256] or rank-two [N, 256] FP32, or execution/readback fails.
Greedily decode logits and require exact UTF-8 output. Errors Returns the errors from decode or crate::ErrorKind::DataLoss when the decoded byte stream is not UTF-8.
Upload raw bytes as a rank-one U8 Matrix on this thread’s default runtime. Errors Returns an error when the default runtime cannot be initialized or when allocation or upload fails.
Upload raw bytes as one batched U8 sequence [1, S] on this thread’s default runtime. Errors Returns an error when the default runtime cannot be initialized or when allocation or upload fails.
Upload raw bytes as one batched U8 sequence [1, S] on a particular runtime. Errors Returns an error when allocation or upload fails.
Upload raw bytes as a rank-one U8 Matrix on a particular runtime. Errors Returns an error when allocation or upload fails.
Upload UTF-8 text without tokenization or normalization on this thread’s default runtime. Errors Returns an error when the default runtime cannot be initialized or when allocation or upload fails.
Upload UTF-8 text without tokenization or normalization on a particular runtime. Errors Returns an error when allocation or upload fails.
Sample one byte from each FP32 logit row. Errors Returns an error for an invalid 256-class logit contract, sampling contract, execution, or readback failure.
Constants & Variables
Functions
Clip FP32 rewards to an inclusive finite range. Errors Returns an error for an empty/non-FP32 input, unordered/non-finite bounds, or Matrix/composite lowering failure.
Normalize and symmetrically clip FP32 observations. Computes clamp((observation - mean) / (stddev + epsilon), -clip, clip) through differentiable Core Matrix operations under one Environment semantic identity. Errors Returns an error for empty/non-FP32 inputs, invalid epsilon/clip, incompatible broadcasting or ownership, or composite lowering failure.
Affinely map FP32 actions between two finite ranges. Errors Returns an error for an empty/non-FP32 input, unordered/non-finite bounds, or Matrix/composite lowering failure.
Types
8 members
Replayable reset/step/observation contract for one Environment. Implementations must keep every replay-visible piece of episode state in device-resident matrices: the captured plans bind those buffers once and replay the identical command sequence, so no host-computed value may differ across replays. Deterministic per-episode variation belongs in on-device counters (as CartPole’s episode_index does) or in the cursor words above.
Source21 members
Stateful native vector-environment behavior. Implementations own semantic environment state and embed exactly one EnvironmentExecution. Public default methods own transaction state, validation boundaries, submission, and rollback; implementations only author reset/step/reset-completed commands and transactional host metadata.
5 members
Private command transaction and exact completion state for one environment. Native environments embed this value and expose it through Environment. It borrows the canonical Runtime recorder for each active transaction; it does not own another queue, allocator, scheduler, or execution graph.
Source15 members
Checked shape, dtype, and range contract for one environment field. shape excludes the leading environment-batch dimension. An empty shape therefore represents one scalar per environment.
Source11 members
Complete single-agent environment schema shared by native and adapter paths.
Source6 members
One batched environment step result preserving termination and truncation.
Source2 members
Optional event-aligned visible depth and native mark. No interpolation.
Source31 members
Device-resident trading dynamics over one Runtime and the canonical lifecycle. Observations append signed exposure, equity/capital, peak/capital, drawdown, remaining horizon, unrealized PnL/capital, position age/horizon and peak unrealized position PnL/capital.
5 members
Per-instrument sizing, costs, initial/maintenance margin and IOC policy. Defaults preserve the original continuous, unlevered next-open simulator.
Source3 members
One piecewise-linear margin tier. Rates are fractions of marked notional.
Source2 members
Closed-bar inputs for one contiguous instrument segment, within one split.
Source4 members
Versioned complete analytical lane state, bound to source tables/config. Snapshot only at exact completion; consumers persist this alongside model, optimizer, PPO action cursor and their own source-receipt identity.
SourceEnums
Constants & Variables
Functions
Deterministically evaluate a categorical policy and return compact telemetry. The complete horizon is recorded and submitted once, followed by one exact wait and three compact rollout readbacks. Greedy action selection uses the donor temperature-zero route. The environment remains open and idle. Errors Returns an error for zero horizon/lanes, a non-discrete environment, model ownership mismatch, environment/model/policy/rollout recording failure, submission/wait failure, readback failure, or counter overflow.
Types
Functions
Advance one explicit Euler step: state + velocity * delta_time. Errors Returns an error unless state and velocity are matching nonempty same-runtime F32 matrices, delta_time is finite, and recording succeeds.
Construct x(t) = clean + t * (noise - clean) and v = noise - clean. A rank-one time vector matching the batch dimension expands across every non-batch axis. Scalars and ordinarily broadcastable time shapes are also accepted. Errors Returns an error unless every input is same-runtime F32, clean and noise are matching and nonempty, time broadcasts to them, and recording succeeds.
Compute mean squared error over broadcast-selected valid elements. The mask contributes its values to the denominator. An all-zero mask returns exact zero by clamping the denominator to one. Target and mask are detached; reverse mode differentiates only prediction. Errors Returns an error unless prediction and target are matching nonempty same-runtime F32 matrices, mask is same-runtime F32 and broadcastable to prediction, and recording succeeds.
Types
Functions
Compute mean binary cross entropy over matching FP32 probability matrices. Predictions use the donor’s [1e-7, 1 - 1e-7] numerical clamp. Targets are treated as detached; reverse mode differentiates only the prediction. Errors Returns an error for empty, mismatched, non-FP32, or cross-runtime inputs, or when allocation or runtime recording fails.
Compute the cosine embedding loss over [N, D] pairs. Rows with target == 1 contribute 1 - cos(x1, x2); rows with target == -1 contribute max(0, cos(x1, x2) - margin). target is an [N, 1] ±1 mask. Errors Returns an error for mismatched, empty, non-rank-two, or non-FP32 inputs, or when runtime recording fails.
Compute mean cross-entropy over rank-two FP32 logits and U32 or I32 class targets. logits has shape [N, C], targets has shape [N], and the returned matrix is an FP32 scalar. I32 targets must be non-negative; any negative or out-of-range target produces NaN without an out-of-bounds access. Errors Returns an error when ranks, shapes, dtypes, ownership, allocation, or runtime recording are invalid.
Compute mean cross-entropy over the rows selected by a floating FP32 mask. logits has shape [N, C]; targets and mask have shape [N]. A zero mask value excludes its row and produces an exact-zero logits adjoint. valid_count is the caller-provided normalization denominator and must be in 1..=N; it is not read back or recomputed from device storage. Reverse mode differentiates only logits. Errors Returns an error when ranks, shapes, dtypes, ownership, valid_count, allocation, or runtime recording are invalid.
Compute the mean connectionist temporal classification loss over a batch. log_probs has shape [T, N, C] and holds log-probabilities over C classes including the blank class. targets has shape [N, S] and holds the label sequences, input_lengths and target_lengths have shape [N] and hold each item’s frame and label counts. blank is the blank class index and must be below C. The returned matrix is an FP32 scalar: the mean of the per-item negative log-likelihoods. Label entries shorter than S and frames beyond an item’s input_lengths entry are ignored. Target classes outside 0..C produce a NaN item loss without an out-of-bounds read, matching the cross-entropy invalid-target contract. Errors Returns an error when ranks, shapes, dtypes, blank, target_lengths width, ownership, allocation, or runtime recording are invalid.
Compose the donor DQN selected-action and detached Bellman-target loss. Termination suppresses next-state bootstrap. Truncation deliberately keeps bootstrap because it ends only the current trace, not the underlying task. Reverse mode therefore connects loss and selected_q only to q. Errors Returns an error unless Q and next-Q are same-runtime nonempty F32 [B,A] matrices with A > 1, action is I32 [B], reward is F32 [B], boundary masks are U8 [B], all fields share one runtime, extents fit the shader ABI, and discount is finite in [0, 1].
Compute the Gaussian negative log likelihood mean(0.5 * (log var + (x - t)^2 / var) + full * 0.5 * log(2 pi)). variance is clamped below at eps, matching the donor’s stability rule. full adds the constant 0.5 * log(2 pi) term. Errors Returns an error for mismatched, empty, or non-FP32 inputs, nonpositive eps, or when runtime recording fails.
Compute the KL divergence loss mean(target * (log target - input)). input holds log-probabilities and target holds probabilities, matching torch.nn.functional.kl_div with log-target input. The target == 0 contribution is exact zero; targets below 1e-12 clamp before the log so the product stays finite. Errors Returns an error for mismatched, empty, or non-FP32 inputs, or when runtime recording fails.
Compute mean absolute error for matching FP32 matrices. The target is treated as detached; reverse mode differentiates only the prediction. Equal prediction and target values use the zero subgradient. Errors Returns an error for empty, mismatched, non-FP32, or cross-runtime inputs, or when allocation or runtime recording fails.
Compute the margin ranking loss mean(max(0, -y * (x1 - x2) + margin)). target is the ±1 direction mask matching the input shapes. Errors Returns an error for mismatched, empty, or non-FP32 inputs, or when runtime recording fails.
Compute mean squared error for matching FP32 matrices. The target is treated as detached; reverse mode differentiates only the prediction. Errors Returns an error for empty, mismatched, non-FP32, or cross-runtime inputs, or when allocation or runtime recording fails.
Compute the multi-label soft margin loss (binary cross-entropy with logits, averaged over classes then batch). input is an [N, C] logit matrix and target an [N, C] 0/1 mask. weight optionally scales each class term by an [N, C]-broadcastable weight matrix. Uses the stable softplus form so large logits do not overflow. Errors Returns an error for mismatched, empty, non-rank-two, or non-FP32 inputs, or when runtime recording fails.
Compute the multiclass hinge loss mean_i((1/C) * sum_{j != y_i} max(0, margin - x[i,y_i] + x[i,j])). input is an [N, C] score matrix and target an I32 [N, 1] class-index matrix. The j == y_i hinge term equals margin, so it is subtracted exactly after the full row sum. Errors Returns an error for non-rank-two, empty, or non-FP32 inputs, mismatched targets, or when runtime recording fails.
Compute the negative log likelihood loss -mean(x[i, target_i]). input is an [N, C] score matrix (usually log-probabilities) and target an I32 [N, 1] class-index matrix. Errors Returns an error for non-rank-two, empty, or non-FP32 inputs, mismatched or out-of-range targets, or when runtime recording fails.
Compute the Poisson negative log likelihood mean(exp(input) - target * input) for log-rate input. Matches the donor’s log_input contract: input is the log-rate, so the rate is exp(input). The Stirling correction (full) is not part of this contract. Errors Returns an error for mismatched, empty, or non-FP32 inputs, or when runtime recording fails.
Compose PPO policy, value, entropy, and total losses. All four outputs are FP32 scalars under one semantic PPO operation. Old log probability, advantage, and target return remain detached by their child operation contracts. Errors Returns an error unless all rollout fields are matching nonempty same-runtime FP32 matrices and every coefficient is valid.
Compute the mean negative clipped PPO surrogate objective. Errors Returns an error unless all inputs are matching nonempty same-runtime FP32 matrices and clip_epsilon is finite in (0, 1).
Compute the explicit clipped-policy adjoint for new log probability. Errors Returns the same validation and runtime errors as ppo_clipped_policy.
Compute the donor entropy-regularized SAC actor objective. The scalar result is mean(alpha * log_probability - min(q1, q2)) and is differentiable through all three inputs. Errors Returns an error unless inputs are matching nonempty same-runtime F32 vectors, entropy coefficient is finite and non-negative, and lowering succeeds.
Compose the donor twin-critic SAC objective. The target is reward + discount * (min(next_q1, next_q2) - alpha * next_log_probability) outside terminal states. Truncation retains that bootstrap. All next-state target fields are detached from reverse mode. Errors Returns an error unless all numerical fields are matching nonempty same-runtime F32 vectors, both boundary masks are matching U8 vectors, discount is finite in [0, 1], entropy coefficient is non-negative and finite, the batch fits the shader ABI, and lowering succeeds.
Compute mean unit-beta Smooth L1 loss for matching FP32 matrices. The target is treated as detached; reverse mode differentiates only the prediction. Errors Returns an error for empty, mismatched, non-FP32, or cross-runtime inputs, or when allocation or runtime recording fails.
Compute the soft margin loss mean(log(1 + exp(-y * x))). Uses the stable softplus form max(z, 0) + log(1 + exp(-|z|)) with z = -y * x, so large margins saturate without overflow. Errors Returns an error for mismatched, empty, or non-FP32 inputs, or when runtime recording fails.
Compute the triplet margin loss mean(max(0, d(a, p) - d(a, n) + margin)) with L2 distances over the last axis. All three inputs share one [N, D] shape; swap (the donor’s distance exchange) is not part of this contract. Errors Returns an error for mismatched, empty, non-rank-two, or non-FP32 inputs, or when runtime recording fails.
Types
Functions
Adaptively average-pool an NCHW Matrix to an exact spatial extent. Each output bin independently uses floor/ceiling boundaries along height and width. This supports rectangular and non-divisible geometry without approximating the operation as a square fixed-window pool. Errors Returns an error unless the input is nonempty rank-four F32, both output extents are nonzero, all geometry fits the shader ABI, or recording fails.
Adaptively average-pool an NCDHW Matrix to exactly output_depth × output_height × output_width. Errors Returns an error unless input is a nonempty rank-five F32 Matrix and all output extents are nonzero, or runtime recording fails.
Adaptively max-pool an NCL Matrix to exactly output_length elements. Each output window covers the [floor(i*L/out), ceil((i+1)*L/out)) source bin, matching nn.AdaptiveMaxPool1d. The returned record carries the pooled output and the flat input index each bin selected; retaining indices is required for reverse-mode gradients. Errors Returns an error unless input is a nonempty rank-three F32 Matrix and output_length is nonzero, or runtime recording fails.
Adaptively max-pool an NCHW Matrix to exactly output_height × output_width, emitting argmax indices. Errors Returns an error unless input is a nonempty rank-four F32 Matrix and both output extents are nonzero, or runtime recording fails.
Adaptively max-pool an NCDHW Matrix to exactly output_depth × output_height × output_width, emitting argmax indices. Errors Returns an error unless input is a nonempty rank-five F32 Matrix and all output extents are nonzero, or runtime recording fails.
Apply two-dimensional average pooling to an NCHW Matrix. Padding positions do not contribute to either the sum or divisor. The output spatial extent is floor((input + 2 * padding - kernel_size) / stride) + 1, matching the OA C++ operation. Errors Returns an error unless input is a nonempty rank-four F32 Matrix, kernel_size and stride are nonzero, the kernel fits the padded input, every shader extent is representable, or runtime recording fails.
Average-pool an NCDHW Matrix with a cubic kernel. Errors Returns an error unless input is a nonempty rank-five F32 Matrix, kernel_size and stride are nonzero, the kernel fits the padded input, or runtime recording fails.
Normalize an NCHW Matrix using statistics computed from the current batch. Errors Returns an error unless input is nonempty rank-four F32, weight and bias are same-runtime F32 channel vectors, epsilon is finite and positive, or runtime recording fails.
Normalize an NCHW Matrix using explicit per-channel statistics. This is the stateless inference form used by crate::ml::nn::BatchNorm2d in evaluation mode. Errors Returns an error unless every value is same-runtime F32, the channel-vector shapes match the input, epsilon is finite and positive, or runtime recording fails.
Multiply corresponding matrices in rank-three batches. Computes [N, M, K] @ [N, K, P] -> [N, M, P]. Errors Returns an error unless inputs are compatible nonempty same-runtime F32 matrices, shape arithmetic fits the shader ABI, or runtime recording fails.
Multiply rank-three batches with right-transposed storage. Computes [N, M, K] @ [N, P, K]^T -> [N, M, P]. Errors Returns an error unless inputs are compatible nonempty same-runtime F32 matrices, shape arithmetic fits the shader ABI, or runtime recording fails.
Multiply rank-three batches with left-transposed storage. Computes [N, K, M]^T @ [N, K, P] -> [N, M, P]. Errors Returns an error unless inputs are compatible nonempty same-runtime F32 matrices, shape arithmetic fits the shader ABI, or runtime recording fails.
Causal kernel-trick attention on raw Q/K/V [BH,S,Dh]. Uses phi(x) = x+1 for nonnegative x and exp(x) otherwise, with max(dot(phi(Q), prefix_sum(phi(K))), epsilon) normalization. Values are not feature-mapped. The fused provider admits 1 <= Dh <= 64; sequence length has no provider cap. It saves Q/K/V, context and one denominator per row for deterministic prefix/suffix reverse mode, never a KV prefix history. Errors Returns an error for unequal/empty shapes, non-F32 or mixed-runtime values, head dimension above 64, nonpositive/nonfinite epsilon, shader ABI overflow, allocation or recording failure.
Normalize the channel axis of a nonempty FP32 [B, C, T] Matrix. Errors Returns an error unless the affine vectors match C, all values belong to one Runtime, epsilon is finite and positive, C <= 1024, or recording fails.
Compute complete explicit channel-normalization adjoints. Errors Returns an error when the forward contract or output gradient is invalid, or runtime recording fails.
Normalize the channel axis of [B, C, T] and fuse the following ReLU. Errors Returns an error under the same conditions as channel_norm, or when runtime recording fails.
Compute complete adjoints of fused channel normalization and ReLU. Errors Returns an error when saved output or gradient does not match the forward contract, or runtime recording fails.
Apply one-dimensional convolution to an NCL Matrix through im2col and GEMM. weight uses [output_channels, input_channels, kernel] layout and bias uses [output_channels]. Dilation applies within each kernel window. Errors Returns an error unless all inputs are nonempty same-runtime F32 matrices, shapes agree, stride and dilation are nonzero, the effective kernel fits the padded input, every extent fits the shader ABI, or recording fails.
Apply bias-free one-dimensional transposed convolution to an NCL Matrix. weight uses [input_channels, output_channels, kernel] layout. The output length is (input_length - 1) * stride - 2 * padding + effective_kernel. Errors Returns an error unless both inputs are nonempty same-runtime F32 matrices, channel geometry agrees, stride and dilation are nonzero, the output extent is positive and fits the shader ABI, or runtime recording fails.
Apply grouped two-dimensional convolution to an NCHW Matrix. weight uses [output_channels, input_channels / groups, kernel, kernel] layout and bias uses [output_channels]. The output spatial extent is floor((input + 2 * padding - kernel) / stride) + 1. Errors Returns an error unless all inputs are same-runtime F32 matrices, shapes and group divisibility agree, the square kernel fits the padded input, every extent fits the shader ABI, or runtime recording fails.
Apply two-dimensional transposed convolution to an NCHW Matrix. weight uses [input_channels, output_channels, kernel, kernel] layout and bias uses [output_channels]. Each output spatial extent is (input_extent - 1) * stride - 2 * padding + kernel. Errors Returns an error unless all inputs are nonempty same-runtime F32 matrices, channel and square-kernel geometry agree, stride is nonzero, output extents are positive and fit the shader ABI, or runtime recording fails.
Apply grouped three-dimensional convolution to an NCDHW Matrix. weight uses [output_channels, input_channels / groups, kernel, kernel, kernel] layout and bias uses [output_channels]. The output spatial extent is floor((input + 2 * padding - kernel) / stride) + 1 on every axis. Errors Returns an error unless all inputs are same-runtime F32 matrices, shapes and group divisibility agree, the cubic kernel fits the padded input, every extent fits the shader ABI, or runtime recording fails.
Apply three-dimensional transposed convolution to an NCDHW Matrix. weight uses [input_channels, output_channels, kernel, kernel, kernel] IOKKK layout and bias uses [output_channels]. Each output extent is (input - 1) * stride - 2 * padding + kernel. Errors Returns an error unless all inputs are nonempty same-runtime F32 matrices, channel and cubic-kernel geometry agree, stride is nonzero, output extents are positive and fit the shader ABI, or runtime recording fails.
Materialize a Float32 matrix with the logical shape retained by input. Errors Returns an error for an empty weight, oversized element counts, or allocation/recording failure.
Return a zero-copy stop-gradient view. The returned Matrix shares storage and forward values with input, but owns a fresh semantic identity with no reverse-mode edge to input. Errors Returns an error only if the input’s existing shape metadata is invalid.
Apply the exponential linear unit elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Apply the explicit causal Flash provider to [BH,S,Dh] values. This compatibility entry point retains the same semantic scaled-dot-product attention identity as scaled_dot_product_attention. It materializes only the output and one FP32 log-sum-exp value per query row. Errors Returns an error unless Q, K, and V are equal nonempty same-runtime F32 matrices, the sequence length is at most 1024, or runtime recording fails.
Combine [N, C * kernel², L] sliding columns into an overlapping NCHW Matrix. This is the deterministic adjoint of unfold: overlapping taps are summed per output element without atomics. output_height and output_width name the reconstructed image extent and must reproduce exactly L = output_height_positions * output_width_positions sliding columns under the same kernel geometry. Errors Returns an error unless input is a nonempty [N, C * kernel², L] rank-three F32 Matrix whose channel count is divisible by kernel² and whose column count equals the sliding extent of the requested output image, kernel/stride/dilation are nonzero, extents fit the shader ABI, or recording fails.
Apply the tanh-approximate Gaussian error linear unit elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Apply one bias-free projection per expert to expert-major packed rows. input is F32 [R, K], weight is F32 [E, N, K], and offsets is the U32 [E+1] boundary output from crate::matrix::moe_expert_plan. The result is F32 [R, N]. Errors Returns an error for incompatible shapes, dtypes, runtime ownership, shader ABI overflow, allocation failure, or runtime recording failure.
Apply one affine projection per expert to expert-major packed rows. input is F32 [R, K], weight is F32 [E, N, K], bias is F32 [E, N], and offsets is the U32 [E+1] boundary output from crate::matrix::moe_expert_plan. The result is F32 [R, N]. Errors Returns an error for incompatible shapes, dtypes, runtime ownership, shader ABI overflow, allocation failure, or runtime recording failure.
Apply one GRU cell update to a caller-supplied hidden state. gates_i has shape [batch, 3 * hidden], hidden has [batch, hidden], weight_hh has [3 * hidden, hidden], and an optional recurrent bias has [3 * hidden]. Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.
Run a whole-sequence GRU recurrence from a zero hidden state. gates_i has shape [batch, sequence, 3 * hidden], weight_hh has [3 * hidden, hidden], and an optional bias_hh has [3 * hidden]. Gate order is reset, update, candidate. Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.
Apply Leaky ReLU elementwise with the requested negative slope. Errors Returns an error unless input is F32 or runtime recording fails.
Apply one LSTM cell update to caller-supplied hidden and cell states. gates_i has shape [batch, 4 * hidden], hidden and cell have [batch, hidden], weight_hh has [4 * hidden, hidden], and an optional recurrent bias has [4 * hidden]. Returns (hidden_next, cell_next). Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.
Run a whole-sequence LSTM recurrence from zero hidden and cell states. gates_i has shape [batch, sequence, 4 * hidden], weight_hh has [4 * hidden, hidden], and an optional bias_hh has [4 * hidden]. Gate order is input, forget, candidate, output. Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.
Run the shared-state Mamba-3 MIMO selective scan. C/B use [B,L,R*G,N]; the three MIMO projections use [H,R,P]; the output-normalization weight always uses [H,P] and is consumed only when config.has_output_norm is true. The remaining layouts match mamba3_siso. Errors Returns an error for mismatched geometry, rank outside 1..=8, unsupported dimensions, shape overflow, or failed runtime recording.
Compute all fifteen explicit Mamba-3 MIMO adjoints. The implementation records the donor’s deterministic prepare, post, reverse-core, inverse-rotation, and reduction stages as one semantic operation. Errors Returns an error for mismatched geometry, unsupported dimensions, shape overflow, or failed runtime recording.
Advance one Mamba-3 MIMO token and update four explicit recurrent states. State layouts are SSM [B,H,P,N], angle [B,H,A], key [B,H,R,N], and value [B,H,R,P]. Errors Returns an error unless config.sequence_length == 1, every operand and state matches the configured same-runtime F32 layout, or recording fails.
Split and transform one packed Mamba-3 input projection. projected has shape [rows, projected_width], where `projected_width = 2inner_size + 2num_groupsmimo_rankstate_size 3*num_heads + num_rope_angles. dt_bias` has one element per head. The operation records one semantic node and one physical dispatch. Errors Returns an error for invalid configuration, incompatible shape, dtype or Runtime ownership, arithmetic overflow, or failed runtime recording.
Compute the packed projection and dt-bias adjoints for Mamba-3 preprocess. output_gradients follows the exact eight shapes returned by mamba3_preprocess. Its dt-bias reduction is ordered by increasing row. Errors Returns an error for invalid configuration, incompatible gradients, shape, dtype or Runtime ownership, arithmetic overflow, or failed runtime recording.
Run the Mamba-3 SISO selective-state recurrence. Operand layouts are C/B [B,L,G,N], x/z/output [B,L,H,P], A-times-dt/dt/trap [B,L,H], angle [B,L,A], C/B bias [H,N], and D [H]. All operands are same-runtime F32 matrices. Errors Returns an error for mismatched geometry, unsupported dimensions, shape overflow, or failed runtime recording.
Compute all explicit Mamba-3 SISO adjoints. The initial OARS physical route is the donor short-training route and accepts L <= 16, P <= 16, N <= 32, and A <= 8. Errors Returns an error for mismatched inputs, a shape outside the admitted short route, overflow, or failed runtime recording.
Advance one Mamba-3 SISO token and update four explicit recurrent states. Operand layouts are the length-one forms accepted by mamba3_siso. State layouts are SSM [B,H,P,N], cumulative angle [B,H,A], previous key [B,H,N], and previous value [B,H,P]. The states are mutated only after the complete operation has been validated and recorded. Errors Returns an error unless config.sequence_length == 1, every operand and state has the configured same-runtime F32 shape, or recording fails.
Multiply [..., K] Float32 activations by a quantized [N, K] weight without materializing a Float32 weight matrix. The result shape is [..., N]. Errors Returns an error unless the weight has rank 2, the input has rank at least 2 with a matching last dimension, all planes are contiguous base storage on one runtime, the flattened dimensions fit the u32 kernel ABI, or allocation/recording fails.
Apply one-dimensional max pooling to an NCL Matrix. Padding positions are excluded from each window. The output extent is floor((input + 2 * padding - kernel_size) / stride) + 1. The returned record carries the pooled output and the flat input index each window selected; retaining indices is required for reverse-mode gradients. Errors Returns an error unless input is a nonempty rank-three F32 Matrix, kernel_size and stride are nonzero, the kernel fits the padded input, every shader extent is representable, or runtime recording fails.
Apply two-dimensional max pooling to an NCHW Matrix. Equal maxima select the first valid input in row-major window order. The returned U32 argmax indices are explicit because they are part of the donor operation contract and make the deterministic adjoint reusable. Errors Returns an error under the same geometry and runtime conditions as avg_pool_2d.
Max-pool an NCDHW Matrix with a cubic kernel, emitting argmax indices. Errors Returns an error unless input is a nonempty rank-five F32 Matrix, kernel_size and stride are nonzero, the kernel fits the padded input, or runtime recording fails.
Scatter NCL pooled values back into an image of output_length using the recorded argmax indices, the adjoint scatter of max_pool_1d. Positions no pooled element selected produce zero. Overlapping windows resolve to the highest pooled index. Errors Returns an error unless input and indices are nonempty rank-three same-shape NCL Matrices on one runtime (indices U32), output_length admits the declared kernel/stride/padding geometry, or runtime recording fails.
Scatter NCHW pooled values back into an image of output_height × output_width using the recorded argmax indices, the adjoint scatter of max_pool_2d. Errors Returns an error unless input and indices are nonempty rank-four same-shape NCHW Matrices on one runtime (indices U32), the declared output geometry admits the kernel/stride/padding window grid, or runtime recording fails.
Invert split_heads into contiguous [B*S, H*(D/H)] storage. The one-head case is a zero-copy differentiable view. Errors Returns an error unless input is nonempty F32 [B*H, S, D/H] with the supplied nonzero dimensions, or runtime recording fails.
Apply Mish elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Combine expert-major packed rows into token-major output using route gates. packed is F32 [T*K, D], route_gate is F32 [T, K], and the U32 maps come from crate::matrix::moe_expert_plan. Errors Returns an error for incompatible shapes, dtypes, runtime ownership, shader ABI overflow, allocation failure, or runtime recording failure.
Pack token rows into stable expert-major route order. input is F32 [T, D]; packed_token and inverse are the U32 [T*K] maps produced by crate::matrix::moe_expert_plan. inverse is retained for the deterministic reverse pass and is not read by the forward kernel. Errors Returns an error for incompatible shapes, dtypes, runtime ownership, shader ABI overflow, allocation failure, or runtime recording failure.
Normalize probabilities over the selected experts for each token. probabilities is F32 [T, E]; expert_indices is I32 [T, K] with 1 <= K <= E. The routing decision is detached from reverse mode, while gradients propagate to the selected probability entries. Errors Returns an error for incompatible shapes, dtypes, runtime ownership, shader ABI overflow, allocation failure, or runtime recording failure.
Quantize Float32 storage into one native OA Q4 or Q8 weight value. The returned value retains the source shape; its physical planes remain private. Errors Returns an error unless the input is a non-empty Float32 matrix whose element byte offsets fit the u32 kernel ABI, or allocation/recording fails.
Apply the rectified linear unit elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Apply weighted root-mean-square normalization over the final dimension. Errors Returns an error unless input is a nonempty F32 Matrix, weight is a same-runtime F32 vector matching its final dimension, epsilon is finite and positive, or runtime recording fails.
Apply per-row RMS normalization, a cyclic broadcast affine, and a SiLU gate. Normalization is over the final input dimension. The affine value may have one or more leading groups; those groups repeat over the flattened input rows. An optional bias must exactly match weight. Errors Returns an error for incompatible shape, dtype, Runtime ownership or epsilon, or when runtime recording fails.
Compute all gated RMS normalization adjoints explicitly. Errors Returns an error for an incompatible output gradient or forward contract, or when runtime recording fails.
Apply one Elman RNN cell update to a caller-supplied hidden state. gates_i and hidden have shape [batch, hidden], weight_hh has [hidden, hidden], and an optional recurrent bias has [hidden]. Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.
Run a whole-sequence Elman recurrence from a zero hidden state. gates_i has shape [batch, sequence, hidden], weight_hh has [hidden, hidden], and an optional recurrent bias has [hidden]. Errors Returns an error unless all values are nonempty same-runtime F32 matrices, shapes agree, hidden size is at most 1024, or runtime recording fails.
Apply split-half rotary position embeddings to [tokens, heads * head_dim]. position_offset selects the first absolute position, making the same operation usable for full sequences and future KV-cache extension. Errors Returns an error unless the input is nonempty F32, head_dim is even, the final width matches num_heads * head_dim, and theta_base is finite and positive.
Apply standard scaled dot-product attention to [B*H, S, D/H] values. additive_mask, when present, is detached F32 [B*H*S, S] storage. Causal visibility is applied without materializing another mask. Errors Returns an error unless Q, K, and V are equal nonempty same-runtime F32 rank-three matrices, the optional mask matches their flattened score rows, or runtime recording fails.
Apply multi-head causal scaled dot-product attention to packed [B*S, D] values. Errors Returns an error unless Q, K, and V are equal nonempty same-runtime F32 matrices, their row count is divisible by sequence_length, their width is divisible by num_heads, or runtime recording fails.
Apply the logistic sigmoid elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Apply the sigmoid linear unit elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Apply SiLU(gate) * up to concatenated halves of the final input axis. Errors Returns an error unless input is F32 with final extent exactly twice the nonzero intermediate_size, or runtime recording fails.
Compute softmax(scores * scale + mask) over the final axis. The additive mask is detached from reverse mode. Errors Returns an error unless both values are equal-shape, nonempty, same-runtime F32 matrices, or runtime recording fails.
Apply the overflow-safe Softplus formulation elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Permute contiguous [B*S, D] storage into [B*H, S, D/H] heads. The one-head case is a zero-copy differentiable view. Errors Returns an error unless input is nonempty F32 [B*S, D], all dimensions are nonzero, D is divisible by num_heads, or runtime recording fails.
Apply SiLU(gate) * up elementwise. Errors Returns an error unless both inputs are equal-shape F32 on the same runtime, or runtime recording fails.
Apply hyperbolic tangent elementwise. Errors Returns an error unless input is F32 or runtime recording fails.
Accumulate scale × value into persistent state inside the recorded graph. target is both read and written: target = target + scale × value in accumulation mode, or target = scale × value in overwrite mode. The mode is device-driven through cursor word 1 — zero accumulates, nonzero overwrites — so captured programs can reset run-scoped state without any host write. Because the update aliases persistent storage, every replay of a capturing program executes it against the accumulated contents; this is the mechanism metric counters, rollout storage, and running statistics use to advance inside compiled training without per-step host readback. target and value must share shape, F32 storage, and Runtime ownership; cursor must be a [2] U32 matrix on the same Runtime. Cursors are ordinary matrices initialized at allocation time, so a program can bind a permanent accumulation cursor and a permanent overwrite cursor and select per call site. This records GPU work but does not submit or wait. Errors Returns an error for mismatched shape, dtype, or Runtime ownership, a non-finite scale, element counts exceeding u32, or recording failure.
Extract sliding NCHW kernel windows into a [N, C * kernel², L] column Matrix. Each column holds one kernel_size × kernel_size patch per input channel in (channel, kernel_y, kernel_x) order, laid out over the L = output_height * output_width sliding positions where output = floor((input + 2 * padding - dilation * (kernel - 1) - 1) / stride) + 1 on every spatial axis. Out-of-bounds taps read as zero, matching the donor im2col contract. Errors Returns an error unless input is a nonempty NCHW rank-four F32 Matrix, kernel/stride/dilation are nonzero, the effective kernel fits the padded input, every extent fits the shader ABI, or recording fails.
Upsample an FP32 NCHW Matrix by a positive integer scale factor. Errors Returns an error unless the input is nonempty rank-four F32, the scale factor is positive, all output geometry is representable, or runtime recording fails.
Assign every FP32 latent row to its nearest FP32 codebook row. Squared L2 distance is used and equal-distance ties select the lower code index, matching OA C++. The hard assignment is detached from reverse mode. Errors Returns an error unless inputs are nonempty same-runtime FP32 [N,D] and [K,D] matrices or recording/allocation fails.
Produce the next VQ EMA state without mutating input Matrix values. This preserves the donor update equations, optional unit-RMS codebook normalization, and exact dead-code revival hash. The owning module installs the returned values into its stable persistent buffer handles. Errors Returns an error for incompatible shapes, dtypes, runtimes, invalid numerical options, ABI overflow, allocation failure, or runtime recording failure.
Gather codebook rows selected by I32 token indices. Invalid indices yield zero rows without an out-of-bounds read. This pure decode operation is detached from reverse mode because EMA owns codebook learning. Errors Returns an error unless the codebook is FP32 [K,D], indices are I32 [N], both belong to one runtime, or recording/allocation fails.
Types
0 members
0 members
The fifteen explicit adjoints of mamba3_mimo.
Source0 members
4 members
A GPU-resident weight stored in OA’s native Q4 or Q8 block encoding. Constructed by quantize; the packed payload and scale planes are private implementation detail and never exposed as public matrix values.
Source0 members
Complete adjoints of broadcast-affine gated RMS normalization.
Source0 members
The eleven explicit adjoints of mamba3_siso.
SourceEnums
OA native block quantization selector. Both formats share one 32-value block layout and one Float32 scale per block. Q4 stores a biased 4-bit index per value (16 bytes per block); Q8 stores one signed byte per value (32 bytes per block).
Q4 · Q8
Types
1 members
Registers an explicitly included MCP view over an existing training session. The server borrows session through its handlers and must be closed or destroyed first. oa/ml deliberately does not opt applications into the network control surface. Rebuild and preview remain absent until their checkpoint and completion contracts are admitted. Donor: oa::McpTraining.
SourceFunctions
Compute last-axis categorical accuracy as a fraction in [0, 1]. Argmax and counting execute on the owning device. Only the resulting U32 scalar crosses the host boundary; this function then waits for that scalar. Equal maximum logits select the first class, matching the OA C++ contract. Errors Returns an error when matrix::categorical_accuracy_count rejects the logits or labels, or submission, completion, or scalar readback fails.
Corpus BLEU over token sequences with a brevity penalty, no smoothing. Counts clipped n-gram matches up to max_order across the corpus and combines them geometrically. A corpus with no matches at any order returns 0.0; hypotheses shorter than references receive the standard exp(1 - ref/hyp) penalty. Inputs are host token sequences — this is an evaluation-side metric, not a device op. Errors Returns an error when max_order is zero, the corpora differ in length, a hypothesis is empty, or any sequence is shorter than max_order.
Macro-averaged F1 over num_classes one-vs-rest counts. Errors Returns an error when num_classes is zero or any per-class count fails.
Per-class prediction/label counts behind one-vs-rest metrics. Logits and labels are read back and the last-axis argmax runs on the host — the same explicit host-observation boundary as scalar_loss, sized for evaluation batches rather than hot loops. A class absent from both predictions and labels reports 0.0 for all derived values rather than a NaN. Equal maximum logits select the first class, matching the OA device argmax contract. Errors Returns an error when logits is not rank-two F32 ["samples", C], labels does not carry one U32/I32 label per row, class_index is out of range for the class axis, or readback fails.
Binary ROC AUC from positive-class scores against binary labels. Scores and labels are read back and ranked on the host with the Mann-Whitney formulation (tied scores share average rank), so the value is exactly the probability that a random positive outranks a random negative. This is an evaluation-side host metric, not a capture-safe device op. Errors Returns an error when scores is not F32, shapes disagree, labels are not 0/1, or one class is absent.
Read one scalar FP32 loss value. This is an explicit host-observation boundary: pending work is submitted and the producing event is awaited before the value is returned. Errors Returns an error unless loss contains exactly one F32 value, or submission, completion, or readback fails.
Types
10 members
Additive correct/sample counters for categorical accuracy. Batch counts recorded through AccuracyCount::record stay device-resident in bounded groups until AccuracyCount::resolve or AccuracyCount::result observes them — the same deferred grouped readback the managed evaluation plane uses, so per-batch host synchronization never happens inside a hot loop. The result is NaN when no samples have been observed.
Source7 members
Per-class prediction/label counts behind precision_recall_f1.
Source17 members
Per-class actual×predicted integer counts behind one-vs-rest metrics. Counts merge by elementwise addition, so arbitrarily partitioned evaluation is exact. Precision, recall, and F1 — macro and micro — derive only at observation time, never per batch. A class absent from both predictions and labels reports zero for its derived values, matching the existing host contract; micro ratios with a zero denominator report NaN.
12 members
Additive token-NLL moments behind perplexity. Perplexity is exp(sum(nll × tokens) / sum(tokens)) with the exponential applied only at observation time. Batches contribute their token-weighted mean negative log-likelihood — exactly what cross_entropy_masked returns when its valid_count is the token denominator — so partitioned language evaluation merges exactly. The contract forbids the mean of per-batch perplexities, which is not the corpus perplexity. Empty denominators report NaN.
Source12 members
Additive error moments behind MAE and RMSE. One batch observation computes both numerators on the device and reads them back together — the same once-per-evaluation-batch host boundary the loss scalar uses. MAE is sum|e| / samples; RMSE squares the mean only at observation time, so partitioned merges stay exact. Empty denominators report NaN.
Source7 members
Additive top-k correct/sample counters. A sample is correct when its label’s logit is at least the k-th largest logit in its row — the inclusive boundary convention, so ties at the threshold count as correct and k ≥ classes is trivially perfect. Like the confusion counts, observation happens at the evaluation plane: logits and labels cross the host boundary once per evaluation batch and the ranking derivation runs host-side. The mergeable state is the same additive correct/samples pair categorical accuracy uses, so partitioned evaluation merges exactly.
Source11 members
Additive numerator/denominator state for one weighted mean. The result is sum / weight — never the mean of per-batch means, which disagrees for uneven final batches. An empty denominator reports NaN rather than zero, so merges with empty state are exact no-ops.
SourceTypes
20 members
21 members
0 members
Output bundle of AdaptiveLogSoftmaxWithLoss::forward: the assembled [N, V] log-probabilities and the mean negative log-likelihood scalar.
Source23 members
Two-level output layer: a head linear scores the most frequent classes plus one logit per tail cluster, while each tail cluster owns a projection and output linear that rescore its classes conditioned on the head cluster probability. Matches the nn.AdaptiveLogSoftmaxWithLoss contract: cutoffs partition 0..n_classes into a head range 0..cutoffs[0] and one tail cluster per cutoff, with tail i projecting in_features down to round(in_features / div_value^(i+1)) before its output linear.
18 members
20 members
21 members
19 members
Elementwise SELU-preserving dropout (nn.AlphaDropout). Applies a * (x * d + alpha' * (1 - d)) + b elementwise, keeping the input mean and variance compatible with SELU activations.
3 members
Caller-owned incremental-decode key/value cache for MultiHeadAttention. Each MultiHeadAttention::step call appends one [B*H, 1, D/H] key/value pair and attends over every cached position. The cache binds to the constructing module instance; presenting it to another attention module fails closed.
Source18 members
Pool a [B*S, D] sequence to [B, D] through a single learned query. The query is a trainable [1, D] parameter broadcast to one query row per batch element, then routed through MultiHeadAttention::forward_kv — the same cross-attention path encoder-decoder uses, with the sequence as key/value source. Equivalent to nn.MultiheadAttention pooling blocks used by ViT-style attention poolers.
18 members
nn.AvgPool1d: [N, C, L] average pooling. Composed over per-window slice + mean — the 2d pooling kernel rejects inputs shorter than the kernel, and matrix::max is full-reduction only, so a max variant stays planned until an axis-max op exists.
21 members
21 members
18 members
nn.BatchNorm1d: [N, C, L] batch normalization. The composed contract reshapes to [N, C, 1, L] and delegates to the shared BatchNorm2d kernel family — batch statistics, running buffers, and adjoints are identical because normalization is per-(N, C) over flattened spatial extents.
29 members
Trainable FP32 BatchNorm over channels of NCHW matrices.
Construct BatchNorm2d with epsilon 1e-5 and momentum 0.1. Errors Returns an error when num_features is zero or state allocation fails.
18 members
nn.BatchNorm3d: [N, C, D, H, W] batch normalization. Shares the BatchNorm2d kernel family by flattening [D, H, W] to [D, H*W] — normalization is per-(N, C) over spatial extents, so the flat layout is equivalent.
22 members
Trainable bilinear interaction out[n, o] = sum_i,j x1[n,i] W[o,i,j] x2[n,j] + b[o]. The weight uses the donor [O, I1, I2] layout and Xavier-uniform initialization matching nn.Linear.
21 members
Fixed 256-row trainable embedding for packed U8 or U32 byte IDs.
21 members
Trainable affine output head from hidden rows to 256 byte logits.
29 members
Multi-head linear attention over packed [B*S, D] values. Uses the Katharopoulos (2020) ELU+1 kernel rather than softmax. Causal heads up to 64 use fused forward and recomputed prefix/suffix adjoints. Saved projections/context scale as O(BHSd), with bounded O(d²) scan state per head. Larger heads retain the compositional path, whose training tape saves O(BHSd²) prefixes. Bidirectional mode uses the global KV composition. Standard attention stores S² probabilities; Flash recomputes them and does not store a global S² score matrix. Parameter layout Four biased projections (q_proj, k_proj, v_proj, out_proj) with the same names and seed stride as MultiHeadAttention, so checkpoints are transferable between the two modules.
Construct four biased projections with causal visibility. Errors Returns an error unless dimensions are positive, model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility. Errors Returns an error unless dimensions are positive, model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility. Errors Returns an error unless dimensions are positive, model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility. Errors Returns an error unless dimensions are positive, model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility. Errors Returns an error unless dimensions are positive, model_width is divisible by num_heads, or child construction/registration fails.
18 members
Shuffle channels between groups equal-sized groups. Input [N, C, *] is flattened to [N, C, S], transposed to rows of channels, gathered by the interleave index c * groups + g, and mapped back — matching the donor channel order with a differentiable adjoint.
20 members
Pad the last dimension by wrapping coordinates around the axis extent. Padding uses PyTorch ordering on the trailing 1 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing two dimensions by wrapping coordinates around each axis extent. Padding uses PyTorch ordering on the trailing 2 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing three dimensions by wrapping coordinates around each axis extent. Padding uses PyTorch ordering on the trailing 3 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the last dimension of a Matrix with a constant value. Padding uses PyTorch ordering on the trailing 1 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing two dimensions of a Matrix with a constant value. Padding uses PyTorch ordering on the trailing 2 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing three dimensions of a Matrix with a constant value. Padding uses PyTorch ordering on the trailing 3 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
28 members
Trainable FP32 one-dimensional convolution over NCL matrices.
Construct a deterministically initialized Conv1d layer. Forward preserves OA’s im2col plus tiled-GEMM route. Weight uses a fan-in-scaled symmetric uniform initializer and bias starts at zero. Errors Returns an error when dimensions, stride, or dilation are zero, shape arithmetic overflows, or allocation/upload fails.
28 members
Trainable grouped FP32 two-dimensional convolution over NCHW matrices.
Construct a deterministically initialized grouped Conv2d layer. The weight initializer is symmetric uniform with bound 1 / sqrt((input_channels / groups) * kernel_size²); bias starts at zero. Errors Returns an error when dimensions are zero, channels are not divisible by groups, shape arithmetic overflows, or allocation/upload fails.
28 members
Trainable grouped FP32 three-dimensional convolution over NCDHW matrices.
Construct a deterministically initialized grouped Conv3d layer. The weight initializer is symmetric uniform with bound 1 / sqrt((input_channels / groups) * kernel_size³); bias starts at zero. Errors Returns an error when dimensions are zero, channels are not divisible by groups, shape arithmetic overflows, or allocation/upload fails.
26 members
Trainable bias-free FP32 one-dimensional transposed convolution over NCL matrices.
Construct a deterministically initialized ConvTranspose1d layer. Weight uses the donor [input_channels, output_channels, kernel] layout, a fan-in-scaled symmetric uniform initializer, and no bias parameter. Errors Returns an error when channels, kernel size, or stride are zero, shape arithmetic overflows, or parameter allocation/upload fails.
27 members
Trainable FP32 two-dimensional transposed convolution over NCHW matrices.
Construct a deterministically initialized ConvTranspose2d layer. Weight uses [input_channels, output_channels, kernel, kernel] layout, a fan-in-scaled symmetric uniform initializer, and zero channel bias. Errors Returns an error when channels, kernel size, or stride are zero, shape arithmetic overflows, or parameter allocation/upload fails.
27 members
Trainable FP32 three-dimensional transposed convolution over NCDHW matrices.
Construct a deterministically initialized ConvTranspose3d layer. Weight uses [input_channels, output_channels, kernel, kernel, kernel] layout, a fan-in-scaled symmetric uniform initializer, and zero channel bias. Errors Returns an error when channels, kernel size, or stride are zero, shape arithmetic overflows, or parameter allocation/upload fails.
19 members
Cosine similarity (nn.CosineSimilarity) over one axis. Emits x1 . x2 / (max(||x1||, eps) * max(||x2||, eps)) keeping the reduced axis at extent one.
19 members
19 members
19 members
19 members
18 members
Exponential linear unit: x for x > 0, alpha * (e^x - 1) otherwise. Stateless composed contract: relu(x) + alpha * (exp(-relu(-x)) - 1), so autograd flows through the elementwise adjoints.
23 members
Trainable FP32 lookup table indexed by an arbitrary-shape U8, U32, or I32 matrix.
Construct a deterministically initialized embedding table. Errors Returns an error when either dimension is zero, shape arithmetic overflows, or allocation/upload fails.
Construct a deterministically initialized embedding table. Errors Returns an error when either dimension is zero, shape arithmetic overflows, or allocation/upload fails.
Construct a deterministically initialized embedding table. Errors Returns an error when either dimension is zero, shape arithmetic overflows, or allocation/upload fails.
Construct a deterministically initialized embedding table. Errors Returns an error when either dimension is zero, shape arithmetic overflows, or allocation/upload fails.
22 members
Bag-of-embeddings lookup: embedding lookup followed by a per-bag reduction, covering the nn.EmbeddingBag contract. forward takes the flattened index matrix plus host offsets delimiting bags — the same boundary choice as torch.nn.EmbeddingBag(mode='mean'|'sum'), with offsets kept on the host side of the CPU/GPU contract because bag boundaries are data-shaping metadata, not device state. The bag loop composes slice + sum/mean + concat, so gradients flow through Embedding’s own adjoint into the shared weight — a composed contract, not a fused kernel.
24 members
OA’s embedding-plus-hybrid-Mamba core with one canonical Rust execution path. The stack interleaves Mamba-3 blocks with evenly spaced causal self-attention blocks (Nemotron-style), each followed by a dense or routed-expert feed-forward tail. Whole-sequence forward runs through the module graph; single-token decode threads caller-owned EmpyrealmState through step/step_embedded.
4 members
Layer schedule and widths for the hybrid Empyrealm stack. attention_every interleaves one causal self-attention block after every attention_every - 1 Mamba-3 blocks, at positions k * attention_every - 1; zero produces a pure Mamba-3 stack. Every block owns a pre-normalized residual mixer plus a dense or routed-expert feed- forward tail, and the stack ends in a final RMSNorm.
Source2 members
Caller-owned per-block decode state for Empyrealm. Entries mirror the block schedule one to one: Mamba-3 blocks own a Mamba3State and attention blocks own an AttentionCache. Obtaining it through Empyrealm::new_state binds it to that module instance and keeps every child owner check intact.
Source33 members
Ready-to-train encoder-decoder Transformer for sequence-to-sequence tasks. Source and target token/position embeddings feed separate block stacks: encoder blocks run bidirectional self-attention, decoder blocks run causal self-attention and bidirectional cross-attention over the encoder output. forward(source, target) returns all-position target logits.
Construct a deterministic encoder-decoder Transformer. Both stacks use num_layers blocks of the same width recipe. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic encoder-decoder Transformer. Both stacks use num_layers blocks of the same width recipe. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic encoder-decoder Transformer. Both stacks use num_layers blocks of the same width recipe. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic encoder-decoder Transformer. Both stacks use num_layers blocks of the same width recipe. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic encoder-decoder Transformer. Both stacks use num_layers blocks of the same width recipe. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic encoder-decoder Transformer. Both stacks use num_layers blocks of the same width recipe. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic encoder-decoder Transformer. Both stacks use num_layers blocks of the same width recipe. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
24 members
One pre-normalized decoder block of an encoder-decoder EncoderDecoder. Applies causal self-attention, bidirectional cross-attention over the encoder output, and a dense GELU feed-forward stage, each behind a pre-norm residual. The cross-attention stage projects its keys and values from the encoder output on every call, so the same block also serves training and uncached evaluation.
Construct the canonical decoder block with causal self-attention and bidirectional cross-attention. Errors Returns an error for invalid dimensions or failed child construction.
Construct the canonical decoder block with causal self-attention and bidirectional cross-attention. Errors Returns an error for invalid dimensions or failed child construction.
Construct the canonical decoder block with causal self-attention and bidirectional cross-attention. Errors Returns an error for invalid dimensions or failed child construction.
19 members
Channel-granular SELU-preserving dropout (nn.FeatureAlphaDropout). Shares one {0, 1} keep mask per [N, C] channel across the trailing axes, then applies the alpha-dropout affine map.
21 members
Pre-normalized SwiGLU feed-forward network with a residual connection. The module preserves the OA donor structure: RMSNorm -> (gate, up) -> SwiGLU -> down -> residual add.
20 members
Flatten an inclusive range of Matrix dimensions into one dimension. Negative dimensions are resolved from the end at call time. The donor default (1, -1) preserves a leading batch dimension.
24 members
Trainable flow/diffusion denoiser with optional condition features and CFG.
Construct a deterministic dense or MoE denoiser. Errors Returns an error for invalid model/time/dropout geometry or failed child, parameter, and buffer construction.
Construct a deterministic dense or MoE denoiser. Errors Returns an error for invalid model/time/dropout geometry or failed child, parameter, and buffer construction.
Construct a deterministic dense or MoE denoiser. Errors Returns an error for invalid model/time/dropout geometry or failed child, parameter, and buffer construction.
Construct a deterministic dense or MoE denoiser. Errors Returns an error for invalid model/time/dropout geometry or failed child, parameter, and buffer construction.
4 members
Configuration for a modality-independent flow/diffusion denoiser.
Source21 members
GPU sinusoidal embedding for normalized continuous flow time.
25 members
Reusable bidirectional Transformer backbone for flow/diffusion denoisers.
Construct a deterministic dense or dropless-MoE flow Transformer. Errors Returns an error for invalid geometry, expert routing, epsilon, or failed child construction and registration.
Construct a deterministic dense or dropless-MoE flow Transformer. Errors Returns an error for invalid geometry, expert routing, epsilon, or failed child construction and registration.
Construct a deterministic dense or dropless-MoE flow Transformer. Errors Returns an error for invalid geometry, expert routing, epsilon, or failed child construction and registration.
Construct a deterministic dense or dropless-MoE flow Transformer. Errors Returns an error for invalid geometry, expert routing, epsilon, or failed child construction and registration.
4 members
Configuration for a bidirectional flow/diffusion Transformer backbone.
Source23 members
18 members
20 members
18 members
Group normalization: normalize each channels / num_groups channel group per sample, then apply a learned per-channel affine. Composed contract over reshape + mean + mul/sub/div/sqrt, so gradients flow through the elementwise and reduce adjoints into weight and bias parameters without a fused kernel. The variance uses the biased mean((x - mu)^2) form matching nn.GroupNorm.
26 members
Stacked batch-first gated recurrent unit using whole-sequence GPU scans. Input uses [batch, sequence, input]; output uses [batch, sequence, hidden]. Every layer starts from a zero hidden state.
25 members
One gated recurrent unit cell with an explicit caller-owned hidden state.
18 members
17 members
Instance normalization: GroupNorm with num_groups == num_channels. Each channel normalizes per sample over its own spatial extent, matching nn.InstanceNormNd semantics without running statistics.
26 members
Trainable FP32 LayerNorm over the final input dimension.
28 members
Trainable FP32 affine projection using [output, input] weight layout.
Construct a deterministically initialized linear layer. seed controls an independent SplitMix64 Xavier-uniform initializer. Errors Returns an error when either feature count is zero, shape arithmetic overflows, or parameter allocation/upload fails.
19 members
Cross-channel normalization x_c / (k + (alpha / size) * sum_j x_j^2)^beta where the sum spans the size-wide neighborhood centered at channel c, clipped at the borders. The window sum is composed over a zero PadMode::Constant channel pad and size shifted slices, so gradients flow through the pad and slice adjoints.
19 members
26 members
Stacked batch-first long short-term memory using whole-sequence composed scans. Input uses [batch, sequence, input]; output uses [batch, sequence, hidden]. Every layer starts from a zero hidden state.
25 members
One long short-term memory cell cell with an explicit caller-owned hidden state.
25 members
Parameter-owning Mamba-3 selective state-space block.
Construct a deterministically initialized Mamba-3 block. The module preserves the donor parameter layout and complete projection → preprocess → SISO scan → optional gated per-head RMSNorm → output-projection path. seed owns an independent deterministic initializer stream. Errors Returns an error for invalid or overflowing geometry, invalid numerical bounds, or failed allocation/registration.
4 members
Construction contract for the donor-backed Mamba-3 block.
Source1 members
Explicit recurrent cache for one Mamba3 module and batch size. The cache owns the selective state, cumulative rotary angle, previous key, and previous value buffers. It is deliberately separate from the module so independent decoding streams never share hidden mutable state.
Source21 members
21 members
21 members
22 members
Parameterless one-dimensional max-unpooling module consuming recorded argmax indices over NCL matrices.
22 members
Parameterless two-dimensional max-unpooling module consuming recorded argmax indices over NCHW matrices.
45 members
Sparse top-k mixture-of-experts feed-forward module. The implementation preserves OA’s expert-major route plan and stacked parameter layout. Routing decisions remain detached while gradients flow through selected gate magnitudes, expert projections, RMSNorm, and the residual input.
Construct a deterministically initialized sparse MoE. experts_per_token is clamped to 1..=num_experts, matching OA C++. The current GPU route planner admits at most 256 experts. Errors Returns an error for zero dimensions, more than 256 experts, invalid epsilon, shape overflow, allocation failure, or registration failure.
8 members
Reduced host telemetry for the latest MoE routing decision.
Source40 members
Multi-head self-attention over packed [B*S, D] values.
Construct four biased projections with causal visibility and automatic backend policy. Errors Returns an error unless dimensions are positive and model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility and automatic backend policy. Errors Returns an error unless dimensions are positive and model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility and automatic backend policy. Errors Returns an error unless dimensions are positive and model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility and automatic backend policy. Errors Returns an error unless dimensions are positive and model_width is divisible by num_heads, or child construction/registration fails.
Construct four biased projections with causal visibility and automatic backend policy. Errors Returns an error unless dimensions are positive and model_width is divisible by num_heads, or child construction/registration fails.
19 members
Pairwise p-norm distance (nn.PairwiseDistance) over one axis. Emits ||x1 - x2||_p keeping the reduced axis at extent one, matching the donor’s keepdim shape.
18 members
Rearrange [N, C*r^2, H, W] to [N, C, H*r, W*r]. The composed contract flattens each sample and remaps elements with a single matrix::gather_last_dim using a host-built I32 index plane — the same channel ordering as nn.PixelShuffle (out[.., c, h*r+i, w*r+j] = in[.., c*r^2 + i*r + j, h, w]). The index plane is rebuilt per forward, matching the explicit host-observation boundary used elsewhere for data-shaping metadata. Parameterless; gradients flow through the gather adjoint.
18 members
Rearrange [N, C, H, W] to [N, C*r^2, H/r, W/r] — the exact inverse of PixelShuffle. Uses the same composed contract as PixelShuffle: flatten each sample and remap elements with one matrix::gather_last_dim over a host-built I32 index plane (out[.., c*r^2 + i*r + j, h, w] = in[.., c, h*r + i, w*r + j]). Parameterless; gradients flow through the gather adjoint.
19 members
Parametric ReLU: max(0, x) - slope * relu(-x) elementwise. num_slope_parameters is 1 for a shared slope or channels for the per-channel nn.PReLU form; channelwise slopes broadcast over the channel (second) axis of rank >= 2 inputs. The slope is a trainable Parameter registered as slope, initialized to 0.25 matching the PyTorch default.
22 members
Affine map x @ W^T + b whose weight stays packed in a QuantMatrix. QuantizedLinear is the model-level quantized-inference contract: the weight is frozen at quantization time, exposes no trainable parameters, and the forward pass dequantizes inside the dispatch rather than materializing an F32 weight on the device. State-dict round-trips run the standard quantize-on-export flow — checkpoints carry the F32 module and from_linear re-derives the packed planes.
20 members
Pad the last dimension by mirroring the border without repeating the edge element. Padding uses PyTorch ordering on the trailing 1 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing two dimensions by mirroring the border without repeating edge elements. Padding uses PyTorch ordering on the trailing 2 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing three dimensions by mirroring the border without repeating edge elements. Padding uses PyTorch ordering on the trailing 3 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
18 members
20 members
Pad the last dimension by clamping coordinates to the edge element. Padding uses PyTorch ordering on the trailing 1 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing two dimensions by clamping coordinates to edge elements. Padding uses PyTorch ordering on the trailing 2 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
20 members
Pad the trailing three dimensions by clamping coordinates to edge elements. Padding uses PyTorch ordering on the trailing 3 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
25 members
Stack of independently EMA-trained residual vector quantizers.
Construct num_levels deterministically initialized quantizers. Errors Returns an error when the level count or configuration is invalid, child state allocation fails, or module registration fails.
23 members
Trainable FP32 RMSNorm over the final input dimension.
28 members
Stacked batch-first Elman recurrent network using whole-sequence GPU scans. Input uses [batch, sequence, input]; output uses [batch, sequence, hidden]. Every layer starts from a zero hidden state.
Construct a deterministically initialized stacked RNN with biases. Errors Returns an error when a dimension or layer count is zero, hidden size exceeds the 1024-element scan limit, arithmetic overflows, or parameter allocation and registration fail.
25 members
One Elman recurrent cell with an explicit caller-owned hidden state.
20 members
22 members
18 members
19 members
21 members
Donor-compatible SwiGLU MLP with optional projection biases.
33 members
Ready-to-train causal Transformer language model. This is the idiomatic Rust spelling of donor oa::NnTransformer: token and position embeddings, registered Transformer blocks, final normalization, and a vocabulary projection.
Construct a deterministic causal language model. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic causal language model. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic causal language model. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic causal language model. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic causal language model. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic causal language model. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
Construct a deterministic causal language model. Errors Returns an error unless all dimensions are positive, the model width is divisible by the head count, positions fit U32, and every child can be constructed and registered.
40 members
One pre-normalized causal Transformer block.
Construct the canonical pre-norm attention and GELU feed-forward block. Errors Returns an error for invalid dimensions or failed child construction.
Construct the canonical pre-norm attention and GELU feed-forward block. Errors Returns an error for invalid dimensions or failed child construction.
Construct the canonical pre-norm attention and GELU feed-forward block. Errors Returns an error for invalid dimensions or failed child construction.
Construct the canonical pre-norm attention and GELU feed-forward block. Errors Returns an error for invalid dimensions or failed child construction.
Construct the canonical pre-norm attention and GELU feed-forward block. Errors Returns an error for invalid dimensions or failed child construction.
Construct the canonical pre-norm attention and GELU feed-forward block. Errors Returns an error for invalid dimensions or failed child construction.
2 members
Per-layer key/value cache set for one autoregressive decode session. Each entry pairs with the same-index Transformer block; every Transformer::step appends one position per layer and advances the decode position used for positional embedding and the context-length bound.
Source18 members
21 members
20 members
26 members
EMA-trained vector quantizer with persistent, non-gradient codebook state.
Construct a deterministically initialized quantizer. Errors Returns an error for an invalid configuration, shape overflow, or failed state allocation/upload.
4 members
Configuration for one EMA-trained vector-quantization codebook.
Source20 members
Pad the trailing two dimensions of a Matrix with zeros. Padding uses PyTorch ordering on the trailing 2 axis or axes: [left, right] for one dimension, [left, right, top, bottom] for two, and [left, right, top, bottom, front, back] for three.
Enums
Execution policy for scaled dot-product attention. Auto selects only a route proven by device-specific performance evidence. It currently preserves the compositional AttentionBackend::Standard provider on every device.
Auto · Standard · Flash · Linear
Types
7 members
One imported ONNX inference graph over device-resident F32 tensors.
SourceFunctions
Clip the combined L2 norm of nonempty FP32 gradients in place. The operation records one GPU reduction followed by one GPU scaling pass. It does not read gradients back to the CPU or wait for completion. Empty matrices are ignored; at most sixteen nonempty gradients are admitted. Errors Returns an error when max_norm is negative or non-finite, more than sixteen nonempty gradients are supplied, gradients do not share one runtime, a gradient is not FP32, storage is duplicated, a size exceeds the shader ABI, or allocation and runtime recording fail.
Clip the combined L2 norm of accumulated Parameter gradients. This is the parameter-level form of clip_grad_norm: each parameter’s live gradient handle is collected, parameters without a gradient are skipped, and gradient values are rescaled so a following Optimizer::step observes clipped values. Up to sixteen nonempty gradients scale in place through the fused two-pass kernel; larger models take an equivalent device-resident reduction and broadcast-rescale path that stores a detached replacement gradient. Call between backward and the optimizer step. Inside crate::ml::Training::step the call belongs in the record closure so the rescale is captured into the training program; in eager steps it belongs before crate::ml::Training::complete_step. Errors Returns an error when max_norm is negative or non-finite, gradients do not share one runtime or are not FP32, storages are duplicated on the fused path, a size exceeds the shader ABI, or allocation and runtime recording fail.
Types
15 members
Adam optimizer over stable Parameter handles.
Source17 members
0 members
Optimizer with a complete native .oam save-and-restore contract. This capability is sealed because persistence must remain synchronized with OA’s versioned model-file codec. Custom optimizers can implement Optimizer for eager training without claiming wire compatibility.
Source15 members
3 members
Resume-relevant GradScaler state: the dynamic scale and the growth counter tracking consecutive finite steps. Configuration factors are construction-time constants and do not participate.
Source14 members
Muon optimizer with Nesterov momentum and rank-two NS5 orthogonalization. Rank-two parameters use the donor Muon matrix pipeline. Other ranks use its fused momentum update; OA never silently delegates them to AdamW.
Source11 members
Optimizer for externally authored parameter updates. NoOpOptimizer lets callers use crate::ml::Training for cadence, metrics, and callbacks while the step body owns all parameter mutation.
Source7 members
Common behavior exposed by an OA optimizer to training policy. This contract deliberately excludes captured-program and persistence internals. Those capabilities depend on optimizer-specific state and are admitted separately only when their complete implementation exists.
Source5 members
A named parameter group for differential optimizer treatment. Groups are construction-time configuration: lr_scale multiplies the optimizer’s base learning rate for member parameters, weight_decay replaces the optimizer-level decay when present (Some(0.0) is the decay exclusion), and frozen parameters keep both their values and their optimizer moments untouched across updates. The name is diagnostic; it participates in validation errors. Group membership must be disjoint and cover the optimizer’s whole parameter set.
Source14 members
Functions
Differentiably evaluate stored categorical actions. Gradients flow through logits, log_probability, and entropy; action indices remain discrete. action and value are zero-copy semantic output aliases, matching OA C++. Errors Returns an error when logits are not FP32 [E,A] with E > 0 and A > 1, actions are not I32 [E], values are not FP32 [E], inputs do not share one runtime, or composite lowering fails.
Differentiably evaluate a stored pre-tanh normal action. Log standard deviation is clamped to [-20, 2]. Actions are mapped from [-1, 1] into [minimum, maximum]; log probability includes the donor tanh Jacobian correction, while entropy is the unsquashed diagonal-normal value. raw_action and value are zero-copy semantic output aliases. Errors Returns an error when mean, log-standard-deviation, and raw-action are not matching nonempty FP32 [E,A] matrices, value is not FP32 [E], inputs do not share one runtime, bounds/epsilon are invalid, a size exceeds the shader ABI, or composite lowering fails.
Sample and evaluate one categorical action per environment. A nonzero seed is deterministic. Seed zero follows the process-local OA RNG convention. The action is sampled from the same logits used for returned log probabilities and entropy. Errors Returns an error when logits are not FP32 [E,A] with E > 0 and A > 1, values are not FP32 [E] on the same runtime, or composite lowering fails.
Sample a reparameterized tanh-normal policy. The returned raw action is mean + exp(clamped_log_stddev) * noise, so gradients flow through both distribution parameters while Philox noise stays detached. A nonzero seed is deterministic; seed zero follows OA’s process-local RNG convention. Errors Returns an error when mean/log-standard-deviation are not matching nonempty FP32 [E,A] matrices, value is not FP32 [E] on the same runtime, bounds/epsilon are invalid, a size exceeds the shader ABI, or composite lowering fails.
Types
Types
4 members
The planes a resolved precision selection actually runs at, as reported against one runtime’s device contract.
Source7 members
A typed precision request for one training run.
SourceEnums
Types
7 members
Device-resident replay values, optionally including sampled source indices.
Source10 members
Circular fixed-capacity owner for off-policy transitions. Batched append and deterministic uniform sampling are recorded on the one owning runtime. Cursor and size are host control metadata and never require a Matrix readback.
Source8 members
One batch of transitions to append to a ReplayBuffer.
SourceTypes
11 members
Time-major matrices retained by one RolloutBuffer.
Source11 members
Stateful fixed-capacity owner for one categorical on-policy rollout. Appends, validity reset, and final GAE are recorded on the owning runtime; host observation remains the explicit submit-and-wait boundary. Storage is allocated once and overwritten in place across completed collection cycles.
Source10 members
One vector-environment transition whose values remain device-resident.
SourceTypes
Functions
Drive a categorical PPO trainer against one vector environment to completion. The loop follows the trainer’s own pacing: while the trainer is not done, collect when the trainer needs collection, then apply one update step. Collection per rollout begins one environment transaction, acts and observes across the configured horizon with auto-reset of completed lanes, ends collection, and submits/waits the transaction; any recording failure aborts collection and cancels the transaction in pairs, matching the tutorial discipline. Evaluation runs every evaluation_interval completed rollouts and once after completion on a fresh environment from make_evaluation_environment, seeded independently of training. model is the policy under training — caller-owned exactly as the trainer borrows it — used for evaluation. Errors Returns environment, collection, update, or evaluation errors.
Types
9 members
Device-resident training accuracy for classification steps. The metric owns a persistent accumulator: each AccuracyObserver::observe call inside the step’s record closure records the correctness count, its cast, and its accumulation — operations that capture into the training program and execute on every replay, so no per-step accuracy readback exists. The single observation is one readback per epoch boundary inside commit_epoch. Epoch isolation is exact cumulative differencing of both the device correct-count and the lifecycle’s exact sample accounting; integer counts in F32 are exact far beyond any training run (2^24 samples), so the counter never resets.
2 members
Cloneable recording handle for one AccuracyMetric. Call AccuracyObserver::observe exactly once per step inside the record closure; in the captured plane the operations record once and execute on every replay, so no per-step accuracy readback exists.
Source12 members
Epoch, interval, best-model, and restore-best checkpoint policy.
Source3 members
One metric value committed to the shared training history. Entries are append-only and ordered: the lifecycle commits training epoch metrics before any epoch-end callback fires, so validation, checkpoint monitors, and early stopping read committed training values in the same boundary. Sinks never re-derive a number another sink read — they query the log.
Source6 members
Reusable compiled collection owner: captured reset/step/GAE plans plus replay accounting.
Source7 members
Buffered one-row-per-completed-step CSV logger. File creation, writes, and close-time flushing happen only at explicit callback boundaries. Abandoning the callback discards any unflushed host buffer; Drop does not hide an I/O failure.
Source10 members
Stateful DQN training coordinator over caller-owned components. The online module, target module, optimizer, replay storage, and runtime remain caller-owned and must outlive this coordinator. Dropping the trainer does not submit, wait, synchronize targets, or fire terminal callbacks; use DqnTrainer::finish for the explicit terminal boundary.
Source5 members
Last completed DQN update and its synchronized scalar loss.
Source13 members
3 members
A supervised evaluation summary with optional exact classification counts.
Source5 members
Aggregate device time for completed, timestamped training steps.
Source6 members
Applies a learning-rate schedule after every completed optimizer step.
Source11 members
14 members
Consecutive phase policy over one super::super::Training lifecycle. The phase schedule does not own another iterator. Its epoch/step totals must exactly match the iterator configuration, and its optional transition hook receives restricted mutable access to the iterator’s existing optimizer.
Source4 members
Evaluation cadence and seeds for one driven PPO run. The rollout budget itself lives in the trainer configuration — the trainer owns pacing and completion.
Source3 members
Accounting-separated outcome of one driven PPO run.
Source24 members
Complete caller-driven categorical PPO lifecycle. The Runtime, model, and optimizer remain caller-owned. The trainer owns only its fixed-capacity rollout and lifecycle state. Drop performs no submission, waiting, or terminal callbacks; call PpoTrainer::finish explicitly.
5 members
Scalar results from the last completed PPO update epoch.
Source6 members
Reusable fixed-geometry PPO backward and AdamW programs. Retain this value across trainers when checkpointing between rollouts. Each minibatch reuses one bounded tape’s storage, accumulating sample-weighted gradients before exactly one AdamW step per epoch. Tail shapes compile once. Drop never submits or waits. Different models/configurations are rejected.
Source9 members
Throttled Keras/tqdm-style wall-throughput progress display.
Source14 members
Coordinator for alternating fixed-capacity collection and optimizer phases.
Source10 members
Stateful fixed-temperature SAC coordinator over caller-owned components.
Source10 members
Final loss, wall-time, device-time, throughput, and run summary.
Source4 members
Fixed-geometry trading reset, policy/step/append and GAE replay programs. Retain alongside the same environment and PpoUpdateProgram across rollouts. Seven cursor words are uploaded once per chunk and advance on device; tables refresh at explicit completed rollout boundaries. Drop never executes or waits.
Source37 members
Exact eager or captured training-step lifecycle. The loop borrows the runtime, optimizer, metrics, and callbacks. Call Training::begin_step before authoring each body, then finish it with Training::complete_step or Training::complete_program_step. Training::finish is the explicit fallible terminal boundary.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
Construct a training lifecycle around one runtime and optimizer. Errors Returns an error when source-unit accounting is non-finite or overflows, or the variable epoch schedule overflows.
8 members
Restricted mutable services available to one callback invocation.
Source3 members
One command submitted by a session client.
Source7 members
Immutable evidence for one training-program compilation stage.
Source2 members
Observations for one training epoch, including a partial final epoch.
Source2 members
2 members
Epoch observations and the terminal state of a managed training run.
Source6 members
Stateful metric updated once after each completed step. Snapshot-only loss-style metrics implement the four legacy methods. Prediction metrics need batch tensors the snapshot does not carry: they instead observe batches inside the step’s record closure (AccuracyObserver::observe) and commit their epoch result to the shared history bus through TrainingMetric::commit_epoch. New code should not add snapshot-only metrics; the snapshot path exists for scalars the lifecycle itself produces.
Source19 members
Fixed-shape forward, backward, and AdamW program captured for Vulkan replay. The first capture records semantic work without executing it. Replays use one cached command buffer and graph-resident optimizer state; no forward, autograd, or optimizer graph is rebuilt on the host.
20 members
Cloneable, thread-safe command and observation handle for one training loop. Attach it to exactly one super::Training instance. Clones may enqueue commands and read bounded evidence from UI, viewer, or service threads.
3 members
Bounded live-control snapshot published by an attached iterator.
Source28 members
9 members
Runs application-owned inference validation at completed lifecycle boundaries. Epoch-based training evaluates once at every epoch end. Step-only training evaluates at each non-zero configured interval and once at train end when the final step was not already evaluated. Evaluation wall time is excluded from training throughput and the callback never submits work on its own.
Source4 members
Cloneable observation handle for the latest completed validation loss. Clones share one thread-affine value so checkpoint, summary, and early-stop callbacks can observe the result without owning or rerunning validation.
SourceEnums
Kind of command applied at a training safe point.
Pause · Resume · Stop · Checkpoint · Evaluate · SetParameter · RequestRecapture · RequestRebuild
Ordered compilation stage for a captured training program.
SemanticValidation · ReplaySafety · Decomposition · Fusion · Placement · Precision · KernelSelection · LoweringValidation · MemoryPlanning · SynchronizationPlanning · CommandRecording
Outcome of one training-program compilation stage.
NotRun · Inherited · Analyzed · Applied · Failed
Live state of an attached training lifecycle.
Running · Paused · Stopping · Completed · Failed
Typed value carried by a command or exposed parameter.
Empty · Boolean(bool) · Integer(i64) · Float(f64) · String(String)
Types
30 members
Complete Animation Language Model ownership and persistence boundary. The tokenizer and prior remain independently trainable children, while this module gives checkpoints one unambiguous tokenizer.* / prior.* tree and exposes their composed tokenization and generation paths.
Construct the complete ALM with deterministic child seeds. Errors Returns an error unless the tokenizer and prior vocabulary contracts agree, or when either child or the ownership tree cannot be constructed.
Construct the complete ALM with deterministic child seeds. Errors Returns an error unless the tokenizer and prior vocabulary contracts agree, or when either child or the ownership tree cannot be constructed.
4 members
Product-level ALM architecture configuration.
Source17 members
Decoder-only ALM motion-token prior. The permanent backbone is causal attention. Its feed-forward policy may be dense, MoE, or hybrid without changing tokenization, conditioning, generation, or the registered persistence tree.
Construct a deterministic ALM prior. Errors Returns an error for inconsistent vocabulary, dimensions, routing policy, generation policy, failed allocation, or child registration.
6 members
16 members
Temporal Conv1d VQ-VAE used by ALM to map motion frames to discrete tokens. The model accepts [batch, frames, input_dim], downsamples time by 2^downsample_stages, performs one level of normalized EMA vector quantization, and reconstructs the original rank-three shape.
Construct the tokenizer with the donor’s deterministic 0xC0FFEE continuous Glorot stream. Errors Returns an error for invalid geometry or quantizer policy, arithmetic overflow, failed allocation/upload, or module-registration failure.
4 members
Architecture and quantization policy for the ALM temporal VQ-VAE tokenizer.
Source3 members
Summary of one external CLIP SafeTensors translation.
Source14 members
Exact frozen CLIP text-with-projection tower used by conditioned ALM.
Translate the published CLIP ViT-L/14 SafeTensors image into native .oam. The translator admits every and only text-tower FP32 tensor, validates exact shapes, ignores unrelated vision/logit-scale tensors, and rejects unknown names below the text namespaces. No Vulkan Runtime is needed for this host conversion. Errors Returns an error for malformed SafeTensors data, a missing/unexpected text tensor, dtype or shape mismatch, arithmetic overflow, or output failure.
Translate the published CLIP ViT-L/14 SafeTensors image into native .oam. The translator admits every and only text-tower FP32 tensor, validates exact shapes, ignores unrelated vision/logit-scale tensors, and rejects unknown names below the text namespaces. No Vulkan Runtime is needed for this host conversion. Errors Returns an error for malformed SafeTensors data, a missing/unexpected text tensor, dtype or shape mismatch, arithmetic overflow, or output failure.
Translate the published CLIP ViT-L/14 SafeTensors image into native .oam. The translator admits every and only text-tower FP32 tensor, validates exact shapes, ignores unrelated vision/logit-scale tensors, and rejects unknown names below the text namespaces. No Vulkan Runtime is needed for this host conversion. Errors Returns an error for malformed SafeTensors data, a missing/unexpected text tensor, dtype or shape mismatch, arithmetic overflow, or output failure.
Translate the published CLIP ViT-L/14 SafeTensors image into native .oam. The translator admits every and only text-tower FP32 tensor, validates exact shapes, ignores unrelated vision/logit-scale tensors, and rejects unknown names below the text namespaces. No Vulkan Runtime is needed for this host conversion. Errors Returns an error for malformed SafeTensors data, a missing/unexpected text tensor, dtype or shape mismatch, arithmetic overflow, or output failure.
Translate the published CLIP ViT-L/14 SafeTensors image into native .oam. The translator admits every and only text-tower FP32 tensor, validates exact shapes, ignores unrelated vision/logit-scale tensors, and rejects unknown names below the text namespaces. No Vulkan Runtime is needed for this host conversion. Errors Returns an error for malformed SafeTensors data, a missing/unexpected text tensor, dtype or shape mismatch, arithmetic overflow, or output failure.
Translate the published CLIP ViT-L/14 SafeTensors image into native .oam. The translator admits every and only text-tower FP32 tensor, validates exact shapes, ignores unrelated vision/logit-scale tensors, and rejects unknown names below the text namespaces. No Vulkan Runtime is needed for this host conversion. Errors Returns an error for malformed SafeTensors data, a missing/unexpected text tensor, dtype or shape mismatch, arithmetic overflow, or output failure.
4 members
Frozen CLIP text-tower architecture consumed by conditioned ALM.
Source3 members
Host token batch consumed by super::ClipText::forward_tokens.
Source9 members
Native OpenAI CLIP byte-BPE tokenizer. The merges input is the canonical bpe_simple_vocab_16e6 text format. It remains an explicit host asset rather than being hidden inside model state.
SourceEnums
Functions
Build tokenizer windows from a loaded HumanML3D dataset. Errors Returns the same errors as build_tokenizer_windows.
Build true-boundary next-token windows for every motion-token sequence. A short sequence produces one padded window. A long sequence produces one full window for every valid start position and never fabricates SOM or EOM at an interior boundary. Errors Returns an error when window_len is zero, sequence length arithmetic overflows, or the inventory exceeds addressable host memory.
Build the donor tokenizer windows: 50% overlap and one exact tail window. Clips shorter than sequence_len do not produce a window. The returned order is stable: clip order, then ascending frame offset. Shuffling remains an explicit training-policy concern. Errors Returns an error when sequence_len is zero or the number of windows overflows addressable host memory.
Evaluate an ALM prior over true-boundary held-out token windows. Conditioned validation uses the first cached caption feature for each sequence, matching the donor rather than the epoch-rotating training rule. Errors Returns an error for incompatible model, sequence, conditioning, or batch geometry, empty validation data, allocation, inference, synchronization, or compact metric readback failure.
Evaluate a tokenizer over one standardized HumanML3D validation split. Errors Returns an error for incompatible model/dataset geometry, empty validation inventory, invalid batching, allocation, inference, synchronization, readback, denormalization, or HumanML3D diagnostic failure.
Gather a cyclic fixed-size prior batch with true-boundary padding. Errors Returns an error for empty windows, zero geometry, invalid window descriptors, invalid motion token IDs, or allocation overflow.
Gather a cyclic fixed-size tokenizer batch from normalized dataset clips. Errors Returns an error for an empty window inventory, zero batch size, mismatched sequence geometry, invalid window, or allocation overflow.
Gather a cyclic tokenizer batch from row-major normalized motion clips. Errors Returns an error for zero geometry, malformed clips, empty or invalid windows, cursor/allocation overflow, or a window outside its source clip.
Tokenize every eligible normalized dataset clip with one trained tokenizer. Clips shorter than one downsample interval are rejected because silently dropping a dataset row would break caption/conditioning alignment. Errors Returns an error for feature-width mismatch, a short/malformed clip, allocation, tokenizer execution, synchronization, or readback failure.
Train tokenizer and prior stages over one HumanML3D dataset, then compose the independently trainable children into one product-level ALM model. A prior with text_feature_dim == 0 is unconditional. A conditioned prior requires the dataset’s validated oa_clip_text_v1 rows and preserves the manifest model identity in the resulting bundle. Errors Returns an error from either stage, token-corpus construction, cached text contract validation, product ownership composition, or count overflow.
Train both ALM stages with native frozen CLIP caption features and embed the text tower plus exact BPE merge asset in the resulting product bundle. Caption features are baked in memory in deterministic dataset/caption order, so this route does not require a pre-existing text_feats cache. Optional held-out data uses the identical frozen encoder and tokenizer asset. Errors Returns the same errors as train_alm_with_validation, plus CLIP model, merge-table, caption tokenization/encoding, projection-width, or native product-composition failures.
Train both ALM stages while evaluating a held-out HumanML3D split at every completed stage epoch. Tokenizer validation observes motion reconstruction directly. After that stage is complete, the same frozen tokenizer creates both train and held-out token corpora so prior validation cannot drift to a different vocabulary. Errors Returns the same errors as train_alm, plus held-out split, tokenization, conditioning, evaluation, or callback failures.
Train an ALM prior with true-boundary token windows and the shared OA iterator/callback lifecycle. This path deliberately uses the eager iterator mode because a padded batch’s valid_count is a host scalar that can change between steps. Replaying a fixed captured push constant would silently apply the wrong normalization. Once dynamic executable-graph scalars are admitted, this restriction can be removed without changing the public training contract. Errors Returns an error for invalid configuration, token or conditioning data, model/configuration mismatch, allocation, autograd, optimizer, runtime, timing, metric, or callback failure. A non-finite completed loss is rejected.
Train the prior and evaluate one held-out corpus at every epoch end. This is the same training implementation as train_prior; the extra argument only attaches OA’s shared ValidationCallback callback. Errors Returns the same errors as train_prior, plus held-out evaluation or callback failures.
Train the temporal ALM VQ-VAE over normalized row-major motion clips. The optimized objective combines reconstruction Smooth L1, velocity Smooth L1, and the configured VQ commitment loss. The iterator’s primary loss remains reconstruction, matching the donor trainalm progress/checkpoint contract. Codebook updates use EMA and are not AdamW parameters. Errors Returns an error for invalid configuration/corpus geometry, allocation, model, autograd, EMA, optimizer, runtime, timing, metric, or callback failure. A non-finite completed reconstruction loss is rejected.
Train the tokenizer and evaluate one held-out split at every epoch end. This is the same training implementation as train_tokenizer; the extra argument only attaches OA’s shared ValidationCallback callback. Errors Returns the same errors as train_tokenizer, plus held-out evaluation or callback failures.
Types
4 members
Stage policies for one complete tokenizer-then-prior ALM run.
Source0 members
Evidence and resulting product model from one complete ALM run.
Source1 members
Borrowed held-out dataset and per-stage evaluation policy.
Source3 members
Owned host batch for one ALM prior training or validation step.
Source2 members
Frozen text features associated with each motion-token sequence. Each entry of by_sequence is a row-major collection of one or more feature_dim caption embeddings. Training selects captions with the donor’s deterministic (seed + epoch + sequence) % caption_count rule.
Source4 members
Complete optimizer and iteration policy for train_prior.
Source3 members
Final evidence from one ALM prior training run.
Source1 members
Borrowed held-out corpus evaluated at every completed prior epoch.
Source5 members
Complete held-out prior diagnostics.
Source3 members
One true-boundary next-token window used to train the ALM prior.
Source4 members
Native .oam persistence policy for one ALM training stage.
Source4 members
Complete optimizer and iteration policy for train_tokenizer.
Source3 members
Final evidence from one ALM tokenizer training run.
Source1 members
Borrowed held-out split evaluated at every completed tokenizer epoch.
Source5 members
Complete held-out tokenizer diagnostics.
SourceFunctions
Fraction of correct predictions over [N, classes] logits and [N] U32/I32 targets. Errors Returns an error from the underlying accuracy operation or readback.
TF-tutorial-mirrored command classifier. Conv2d(1→8, 3×3) → ReLU → MaxPool → Conv2d(8→16, 3×3) → ReLU → MaxPool → Flatten → Linear(→64) → ReLU → Dropout(0.25) → Linear(→classes), returned as a Sequential so parameter registration and train/eval propagation are uniform with every other nn workload. mel_bands/mel_frames are the unpooled feature extents; two stride-2 pools quarter each spatial axis before the flatten. Errors Returns an error when dimensions are zero or a layer fails to build.
Construct the commands CNN on an explicit runtime. Errors Returns an error when dimensions are zero or a layer fails to build.
Mean and reciprocal standard deviation over a host feature batch. Returns (mean, 1/(std + 1e-6)); callers apply the pair to both training and evaluation features — the host-side equivalent of the TF tutorial’s Normalization layer.
Apply (v - mean) * inv_std to every feature in place.
Types
2 members
One decoded clip: mono FP32 samples padded or trimmed to SAMPLES_PER_CLIP, plus its command class index.
Source6 members
Ordered speech-commands dataset backed by <dir>/<label>/*.wav files.
Load and decode every clip under <dir>/<label>/. Clips are sorted per label for deterministic ordering, decoded to mono, resampled to CLIP_SAMPLE_RATE when needed, and zero-padded or trimmed to SAMPLES_PER_CLIP. Errors Returns an error when a label directory is missing, a clip fails to decode, or the dataset is empty.
Load and decode every clip under <dir>/<label>/. Clips are sorted per label for deterministic ordering, decoded to mono, resampled to CLIP_SAMPLE_RATE when needed, and zero-padded or trimmed to SAMPLES_PER_CLIP. Errors Returns an error when a label directory is missing, a clip fails to decode, or the dataset is empty.
Load and decode every clip under <dir>/<label>/. Clips are sorted per label for deterministic ordering, decoded to mono, resampled to CLIP_SAMPLE_RATE when needed, and zero-padded or trimmed to SAMPLES_PER_CLIP. Errors Returns an error when a label directory is missing, a clip fails to decode, or the dataset is empty.
Constants & Variables
pub const BATCH_SIZE: usize = 8;Source pub const CLIP_SAMPLE_RATE: u32 = 16_000;Source pub const COMMAND_LABELS: [&str; 8];Source pub const MEL_BANDS: u32 = 40;Source pub const MEL_CHUNK_CLIPS: usize = 512;Source pub const MEL_FFT_SIZE: u32 = 1_024;Source pub const MEL_HOP_SIZE: u32 = 256;Source pub const RNG_SEED: u64 = 20_260_818;Source pub const SAMPLES_PER_CLIP: usize = 16_000;Source pub const TRAINING_EPOCHS: usize = 10;Source Functions
Compute all-position argmax accuracy as a fraction in [0, 1]. This is an explicit host-observation boundary. Errors Returns an error unless logits are F32 [N, C], targets contain N U32 values, or readback fails.
Decode canonical character tokens.
Decode one canonical character token. Invalid values decode to space.
Encode text into canonical character tokens.
Encode one character using the canonical a-z plus space vocabulary.
Greedily generate BPE tokens until byte_count decoded source bytes. The decoded result is truncated to prompt.len() + byte_count, matching the donor when the last learned token crosses the requested byte boundary. Errors Returns an error for an empty prompt, invalid model output/token IDs, byte accounting overflow, or failed execution/readback.
Greedily generate exact bytes with the canonical left-filled/sliding window. Errors Returns an error for an empty prompt, invalid model output, or failed execution/readback.
Greedily generate characters with the canonical left-filled/sliding window. Errors Returns an error for an empty prompt, when model execution/readback fails, or if the model violates its declared output shape.
Greedily generate characters through the model’s KV-cached decode path. CharTransformer::step replaces the per-token full-context forward: the prompt warms the cache one position at a time and each generated token costs one incremental step. Output is identical to generate_greedy while generation stays inside the context window — the cache cannot evict, so prompt.len() + count must not exceed CONTEXT_LENGTH. Errors Returns an error for an empty prompt, an over-long generation, invalid model output, or failed execution/readback.
Types
5 members
Canonical BPE language model: Embedding → GRU → Linear.
5 members
Canonical BPE Mamba-3 language model with a flat residual head.
5 members
Canonical BPE Transformer with four sparse top-two experts.
5 members
Canonical BPE language model: Embedding → Elman RNN → Linear.
7 members
Deterministic dense all-position sampler over canonical BPE tokens.
5 members
Canonical BPE Transformer language model over the shared NN owner.
5 members
Canonical byte language model using the hybrid Empyrealm ownership tree.
5 members
Canonical byte language model: ByteEmbedding → GRU → ByteHead.
5 members
Canonical raw-byte Mamba-3 language model with a flat residual head.
5 members
Canonical byte Transformer with four sparse top-two experts.
5 members
Canonical byte language model: ByteEmbedding → Elman RNN → ByteHead.
4 members
5 members
Canonical byte Transformer language model over the shared NN owner.
5 members
Canonical character language model: Embedding → GRU → Linear.
6 members
Canonical character Mamba-3 language model with a flat residual head.
6 members
Canonical character Transformer with four sparse top-two experts.
5 members
Canonical character language model: Embedding → Elman RNN → Linear.
4 members
7 members
Canonical 10,875-parameter character Transformer language model.
Constants & Variables
pub const BATCH_SIZE: usize = 64;Source pub const BPE_GRU_ACCURACY: f32 = 0.988_281;Source pub const BPE_GRU_FINAL_LOSS: f32 = 0.021_224;Source pub const BPE_GRU_REFERENCE_GENERATION: &[u8] = b"to bee arms against a sea of troubles and by opposing end them to be or not to be tha";Source pub const BPE_MAMBA3_ACCURACY: f32 = 0.989_258;Source pub const BPE_MAMBA3_FINAL_LOSS: f32 = 0.019_415;Source pub const BPE_MAMBA3_REFERENCE_GENERATION: &[u8] = b"to beion wher tis nobler in the mind to suffer the slings and arrows of outrageous fo";Source pub const BPE_MERGES: usize = _; // 64usizeSource pub const BPE_MOE_ACCURACY: f32 = 0.988_281;Source pub const BPE_MOE_FINAL_LOSS: f32 = 0.019_962;Source pub const BPE_MOE_REFERENCE_GENERATION: &[u8] = b"to bee or not to be that is the question whether tis nobler in the mind to suffer the";Source pub const BPE_RNN_ACCURACY: f32 = 0.988_281;Source pub const BPE_RNN_FINAL_LOSS: f32 = 0.020_861;Source pub const BPE_RNN_REFERENCE_GENERATION: &[u8] = b"to be not to be that is the question whether tis nobler in the mind to suffer the sli";Source pub const BPE_TRANSFORMER_ACCURACY: f32 = 0.989_258;Source pub const BPE_TRANSFORMER_FINAL_LOSS: f32 = 0.020_028;Source pub const BPE_TRANSFORMER_REFERENCE_GENERATION: &[u8] = b"to be end them to be or not to be that is the question whether tis nobler in the mind";Source pub const BPE_VOCAB_SIZE: usize = 320;Source pub const BYTE_EMPYREALM_ACCURACY: f32 = 0.929_688;Source pub const BYTE_EMPYREALM_FINAL_LOSS: f32 = 0.179_619;Source pub const BYTE_EMPYREALM_REFERENCE_GENERATION: &[u8] = b"to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const BYTE_GRU_ACCURACY: f32 = 0.926_758;Source pub const BYTE_GRU_FINAL_LOSS: f32 = 0.176_505;Source pub const BYTE_GRU_REFERENCE_GENERATION: &[u8] = b"to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const BYTE_MAMBA3_ACCURACY: f32 = 0.929_688;Source pub const BYTE_MAMBA3_FINAL_LOSS: f32 = 0.207_903;Source pub const BYTE_MAMBA3_REFERENCE_GENERATION: &[u8] = b"to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const BYTE_MOE_ACCURACY: f32 = 0.925_781;Source pub const BYTE_MOE_FINAL_LOSS: f32 = 0.193_275;Source pub const BYTE_MOE_FINAL_LOSS_TOLERANCE: f32 = 0.005;Source pub const BYTE_MOE_REFERENCE_GENERATION: &[u8] = b"to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const BYTE_RNN_ACCURACY: f32 = 0.921_875;Source pub const BYTE_RNN_FINAL_LOSS: f32 = 0.186_080;Source pub const BYTE_RNN_REFERENCE_GENERATION: &[u8] = b"to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const BYTE_TRANSFORMER_ACCURACY: f32 = 0.928_711;Source pub const BYTE_TRANSFORMER_FINAL_LOSS: f32 = 0.190_565;Source pub const BYTE_TRANSFORMER_REFERENCE_GENERATION: &[u8] = b"to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const CHAR_GRU_ACCURACY: f32 = 0.927_734;Source pub const CHAR_GRU_FINAL_LOSS: f32 = 0.179_721;Source pub const CHAR_GRU_REFERENCE_GENERATION: &str = "to be or not to be that is the question whether tis nobler in the mind to suffer the ";Source pub const CHAR_MAMBA3_ACCURACY: f32 = 0.929_688;Source pub const CHAR_MAMBA3_FINAL_LOSS: f32 = 0.190_578;Source pub const CHAR_MAMBA3_REFERENCE_GENERATION: &str = "to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const CHAR_MOE_TRANSFORMER_CPP_ACCURACY: f32 = 0.932;Source pub const CHAR_MOE_TRANSFORMER_CPP_FINAL_LOSS: f32 = 0.190_7;Source pub const CHAR_MOE_TRANSFORMER_REFERENCE_GENERATION: &str = "to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const CHAR_RNN_REFERENCE_GENERATION: &str = "to be that is the question whether tis nobler in the mind to suffer the slings and ar";Source pub const CHAR_TRANSFORMER_CPP_ACCURACY: f32 = 0.927;Source pub const CHAR_TRANSFORMER_CPP_FINAL_LOSS: f32 = 0.190_238;Source pub const CHAR_TRANSFORMER_REFERENCE_GENERATION: &str = "to be or not to be that is the question whether tis nobler in the mind to suffer the ";Source pub const CHAR_VOCAB_SIZE: usize = 27;Source pub const CONTEXT_LENGTH: usize = 16;Source pub const CORPUS: &str = "to be or not to be that is the question whether tis nobler in the mind to suffer the slings and arrows of outrageous fortune or to take arms against a sea of troubles and by opposing end them to be or not to be that is the question whether tis nobler in the mind to suffer the slings and arrows of outrageous fortune or to take arms against a sea of troubles and by opposing end them to be or not to be that is the question whether tis nobler in the mind to suffer the slings and arrows of outrageous fortune or to take arms against a sea of troubles and by opposing end them ";Source pub const GENERATION_LENGTH: usize = 80;Source pub const GENERATION_PROMPT: &str = "to be";Source pub const HIDDEN_WIDTH: usize = 64;Source pub const MODEL_WIDTH: usize = 32;Source pub const MOE_EXPERTS_PER_TOKEN: usize = 2;Source pub const MOE_EXPERT_HIDDEN_WIDTH: usize = 16;Source pub const MOE_NUM_EXPERTS: usize = 4;Source pub const RNG_SEED: u64 = 20_260_714;Source pub const TRAINING_STEPS: usize = 300;Source Functions
Human-readable label for a LunarAction.
Record, submit, and wait for one complete Lunar PPO rollout. Errors Returns an error from environment reset/recording/submission or PPO collection. A rejected recording rewinds both owners transactionally.
Draw the CartPole track, cart, pole, force arrow, and telemetry bar into ui.
Draw the 2D Lunar Lander terrain, flags, spacecraft, legs, plumes, and HUD into ui.
Drive epsilon-greedy interaction and DQN updates to the update budget. The loop interleaves one vectorized environment interaction with updates_per_step trainer updates once replay warmup completes. Every interaction is one recorded transaction: selection noise, the step kernel, the replay append copy (capturing the pre-reset successor, so truncation bootstrap reads the correct state), and the completed-lane reset. The environment must hold committed state or never have been submitted — the driver applies the seeded initial reset exactly as the PPO driver does. Driving ends when the trainer completes its update budget or the interaction budget is exhausted. Errors Returns environment, selection, replay, or update errors.
Drive stochastic-policy interaction and SAC updates to the update budget. The loop interleaves one vectorized environment interaction with updates_per_step trainer updates once replay warmup completes. Every interaction is one recorded transaction: the actor forward, tanh-squashed Gaussian sampling, the step kernel, the replay append copy (capturing the pre-reset successor, so truncation bootstrap reads the correct state), and the completed-lane reset. Driving ends when the trainer completes its update budget or the interaction budget is exhausted. The actor module receives [lanes, observation_elements] and must return [lanes, 2 * action_dimensions] — mean then log-standard-deviation, exactly as the trainer’s update-time composition requires. Errors Returns environment, sampling, replay, or update errors.
Human-readable label for a LunarEndReason.
Per-lane epsilon-greedy action selection over Q-value rows. q is a [lanes, action_count] F32 matrix; the result is a [lanes] I32 action vector. With probability epsilon each lane selects a uniform-random action, otherwise the first argmax of its row. Noise is a deterministic function of seed, selection_index, and lane, so runs reproduce exactly while successive selections never reuse noise. Errors Returns kernel compilation, validation, or dispatch errors.
Evaluate episode zero of a fresh flat vector environment with greedy TopK. Completed lanes are not reset. Bounded rollout chunks retain action, value, reward, and boundary history without a per-step host synchronization. Errors Returns an error for invalid dimensions, ownership/model/environment/runtime failure, malformed device results, or inconsistent final telemetry.
Human-readable label for a discrete 2D Lunar Lander action (0..=3).
Evaluate the linearly interpolated lunar terrain height at world x in [-10, 10].
Return the 11 deterministic terrain heights spanning x in [-10.0, 10.0] for (seed, environment, episode), bit-identical to the GPU step shader.
Pretrain only the categorical policy tower from the scripted scalar oracle. The temporary optimizer has independent moment state. A caller-created PPO optimizer therefore remains at step zero for a clean critic warm-up. Errors Returns an error for an invalid curriculum, teacher/evaluator seed overlap, scalar simulation failure, upload/model/loss/autograd failure, or incomplete optimizer accounting.
Read lane 0 from a quiescent 1-lane LunarLander2d environment into a render frame.
Render one CartPole frame offscreen on the GPU and return an oa::Texture.
Render one 2D Lunar Lander frame offscreen on the GPU and return an oa::Texture.
Deterministic PD heuristic controller matching Gymnasium LunarLander-v3’s built-in heuristic(env, s) for instant safe-landing demonstrations and evaluation.
Deterministic scalar controller used by the donor solvability oracle.
Types
25 members
5 members
Versioned dynamics and vector-lane policy for CartPole-v1.
Source4 members
Snapshot of one CartPole-v1 lane used for rendering and trajectory plots.
Source8 members
Interactive oa::Viewer live source demonstrating a CartPole-v1 policy on GPU.
Source0 members
Device-resident CartPole episode state captured at a quiescent boundary. Produced by CartPole::capture_state and consumed by CartPole::restore_state for exact training resume. The matrices are deep copies; the snapshot owns no environment lifetime.
Source5 members
Bounded contact-solver evidence for one policy step.
Source21 members
4 members
Complete first-episode Lunar policy evidence.
Source27 members
5 members
Versioned dynamics and vector-lane policy for 2D Lunar Lander.
Source4 members
Snapshot of one 2D Lunar Lander lane used for rendering, filmstrips, and telemetry.
Source8 members
Interactive oa::Viewer live source demonstrating 2D Lunar Lander on GPU.
Source0 members
Device-resident 2D Lunar Lander episode state captured at a quiescent boundary.
Source6 members
4 members
Compact synchronized host telemetry for one vector lane.
Source8 members
Interactive oa::Viewer live source rendering Lunar Lander 3D in Vulkan.
Source4 members
Configuration for headless or live 3D Vulkan rendering of Lunar Lander 3D.
Source8 members
Reusable Vulkan 3D scene renderer over oa::render::Renderer.
Source5 members
23 members
4 members
Vector-lane count, reset seed, and versioned environment behavior.
Source4 members
Result and actuator accounting from one scalar integration step.
Source6 members
Decomposed reward evidence for one completed environment transition.
Source14 members
4 members
Deterministic flat-terrain scripted-teacher curriculum.
Source4 members
Completed scripted-teacher dataset and optimization evidence.
Source16 members
Immutable checked Lunar Lander height field.
Source5 members
Checked rectangular terrain-generation contract.
Source4 members
Exact height and normal returned for one terrain coordinate.
Source4 members
One scalar environment transition and its diagnostic evidence.
Source25 members
5 members
Versioned dynamics and vector-lane policy for Pendulum-v1.
Source0 members
Device-resident Pendulum episode state captured at a quiescent boundary.
SourceEnums
Discrete control selected for one simulation step.
Coast = 0 · MainEngine = 1 · PitchPositive = 2 · PitchNegative = 3 · RollPositive = 4 · RollNegative = 5 · YawPositive = 6 · YawNegative = 7
Terminal or truncation cause for one episode.
None = 0 · SafeLanding = 1 · BodyImpact = 2 · HardFootImpact = 3 · OutOfBounds = 4 · NumericalFailure = 5 · TimeLimit = 6 · ExternalStop = 7 · InvalidAction = 8
Outcome status of a 2D Lunar Lander episode.
Flying = 0 · Landed = 1 · Crashed = 2 · OutOfBounds = 3 · Timeout = 4
Independent deterministic random domain within one episode.
Terrain = 6_072_350_185_815_100_977 · Spawn = 6_003_370_146_514_612_273 · Domain = 4_922_237_860_537_315_377
Constants & Variables
pub const LUNAR_ENVIRONMENT_VERSION: u32 = 1;Source pub const LUNAR_LANDER_2D_ACTION_COUNT: usize = 4;Source pub const LUNAR_LANDER_2D_OBSERVATION_SIZE: usize = 8;Source pub const LUNAR_LANDER_2D_TERRAIN_CHUNKS: usize = 11;Source pub const LUNAR_OBSERVATION_SIZE: usize = 33;Source pub const LUNAR_OBSERVATION_VERSION: u32 = 1;Source pub const LUNAR_PHYSICS_VERSION: u32 = 1;Source pub const LUNAR_RANDOM_VERSION: u32 = 1;Source pub const LUNAR_REWARD_VERSION: u32 = 1;Source pub const LUNAR_TERRAIN_VERSION: u32 = 1;Source Functions
Human-readable label for a LunarAction.
Record, submit, and wait for one complete Lunar PPO rollout. Errors Returns an error from environment reset/recording/submission or PPO collection. A rejected recording rewinds both owners transactionally.
Human-readable label for a LunarEndReason.
Evaluate episode zero of a fresh flat vector environment with greedy TopK. Completed lanes are not reset. Bounded rollout chunks retain action, value, reward, and boundary history without a per-step host synchronization. Errors Returns an error for invalid dimensions, ownership/model/environment/runtime failure, malformed device results, or inconsistent final telemetry.
Advance one scalar state with the donor’s fixed-order semi-implicit solver. Errors Returns an error for invalid configuration, mismatched terrain, invalid input state, or non-finite integration/contact output. The state may have been partially advanced when a numerical output failure is reported.
Produce the frozen 33-value normalized observation layout.
Return the bounded donor potential used by reward shaping.
Pretrain only the categorical policy tower from the scripted scalar oracle. The temporary optimizer has independent moment state. A caller-created PPO optimizer therefore remains at step zero for a clean critic warm-up. Errors Returns an error for an invalid curriculum, teacher/evaluator seed overlap, scalar simulation failure, upload/model/loss/autograd failure, or incomplete optimizer accounting.
Deterministic scalar controller used by the donor solvability oracle.
Return a support’s world-space center.
Types
5 members
Bounded contact-solver evidence for one policy step.
Source21 members
4 members
Complete first-episode Lunar policy evidence.
Source6 members
4 members
Compact synchronized host telemetry for one vector lane.
Source8 members
Interactive oa::Viewer live source rendering Lunar Lander 3D in Vulkan.
Source4 members
Configuration for headless or live 3D Vulkan rendering of Lunar Lander 3D.
Source8 members
Reusable Vulkan 3D scene renderer over oa::render::Renderer.
Source5 members
23 members
4 members
Vector-lane count, reset seed, and versioned environment behavior.
Source4 members
Result and actuator accounting from one scalar integration step.
Source6 members
Decomposed reward evidence for one completed environment transition.
Source14 members
4 members
Deterministic flat-terrain scripted-teacher curriculum.
Source4 members
Completed scripted-teacher dataset and optimization evidence.
Source16 members
Immutable checked Lunar Lander height field.
Source5 members
Checked rectangular terrain-generation contract.
Source4 members
Exact height and normal returned for one terrain coordinate.
Source4 members
One scalar environment transition and its diagnostic evidence.
SourceEnums
Discrete control selected for one simulation step.
Coast = 0 · MainEngine = 1 · PitchPositive = 2 · PitchNegative = 3 · RollPositive = 4 · RollNegative = 5 · YawPositive = 6 · YawNegative = 7
Terminal or truncation cause for one episode.
None = 0 · SafeLanding = 1 · BodyImpact = 2 · HardFootImpact = 3 · OutOfBounds = 4 · NumericalFailure = 5 · TimeLimit = 6 · ExternalStop = 7 · InvalidAction = 8
Independent deterministic random domain within one episode.
Terrain = 6_072_350_185_815_100_977 · Spawn = 6_003_370_146_514_612_273 · Domain = 4_922_237_860_537_315_377
Constants & Variables
pub const LUNAR_ENVIRONMENT_VERSION: u32 = 1;Source pub const LUNAR_OBSERVATION_SIZE: usize = 33;Source pub const LUNAR_OBSERVATION_VERSION: u32 = 1;Source pub const LUNAR_PHYSICS_VERSION: u32 = 1;Source pub const LUNAR_RANDOM_VERSION: u32 = 1;Source pub const LUNAR_REWARD_VERSION: u32 = 1;Source pub const LUNAR_TERRAIN_VERSION: u32 = 1;Source pub const LUNAR_VECTOR_CONFIG_LAYOUT_VERSION: u32 = 1;Source pub const LUNAR_VECTOR_STATE_LAYOUT_VERSION: u32 = 1;Source Functions
Right-pad a batch: source tokens zero-padded, target input is BOS actions... right-padded, labels are actions... EOS right-padded, loss mask covers exactly the action and EOS positions.
Tokenize every example and report the geometry the workload fixes.
Types
0 members
One right-padded training batch with masks and masked-loss inputs, held as host values until the training loop uploads them.
Source0 members
Upload one batch’s tensors for a masked training step.
Source0 members
Decode an oads SCAN byte-matrix field into per-example word lists. Rows are zero-padded little-endian byte values; text truncates at the first zero byte and splits on whitespace. Whitespace-split words per example for one SCAN field pair.
Source4 members
Word-level vocabulary with deterministic alphabetical index assignment.
Build from whitespace-separated words over all examples, reserving indices 0..reserved for special tokens.