Skip to content

Tensor Ops

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

Tensor Ops

Wiki hero

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)

src/tensor/ops.rs — free functions on &Tensor.

Function Role
matmul(a, b) [M×K]×[K×N]→[M×N] tiled CPU matmul
batched_matmul Batched matmul variant
layer_norm(x, weight, bias, eps) Standard LN
rms_norm(x, weight, eps) RMSNorm
embedding(table, ids) Gather rows by u32 ids
causal_mask(seq_len) Additive causal attention mask

These power transformer forward paths (embedding + matmul + norms).

Note: Comments may mention a future gpu dispatch; project non-goals forbid shipping a CUDA backend in this crate. Treat ops as CPU-first.


Last updated: July 29, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: 37c5a21 (main)

Clone this wiki locally