Documentation
¶
Overview ¶
Package goai is a Go-native, full-spectrum AI library built Pure-Go-first / cgo-last. See SPEC.md for goals (§G), constraints (§C), architecture invariants (§I), and verification invariants (§V).
Layer model (§I):
L0 tensor core: Tensor, Dtype, strides/views
L1 backend Backend/Kernel interface + Pure-Go reference (truth)
L1b backend/* swappable accel backends (metal, vulkan, cuda) + fallback
L2 autograd tape/graph + VJP rules
L3 nn, ops, linalg layers/optimizers/losses; eager ops; dense linear algebra
L4 nlp, vision, domains
classic, rl
L5 format safetensors, GGUF, npy/npz
— llamagpu batched GPU decoding for GPT/Llama
Invariant: higher layers never import backend internals; every op has a Pure-Go fallback; CGO_ENABLED=0 builds green on macOS, Windows, Linux.
Index ¶
Constants ¶
View Source
const Version = "0.0.0-dev"
Version is the current library version. Pre-release: API unstable (§V8).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package autograd is layer L2: tape-based reverse-mode automatic differentiation (ADR-0006).
|
Package autograd is layer L2: tape-based reverse-mode automatic differentiation (ADR-0006). |
|
Package backend is layer L1: the compute abstraction (ADR-0003).
|
Package backend is layer L1: the compute abstraction (ADR-0003). |
|
cpu
Package cpu is the optimized Pure-Go CPU backend (layer L1b).
|
Package cpu is the optimized Pure-Go CPU backend (layer L1b). |
|
cuda
Package cuda is the optional NVIDIA CUDA/cuBLAS GPU backend (layer L1b, §T42).
|
Package cuda is the optional NVIDIA CUDA/cuBLAS GPU backend (layer L1b, §T42). |
|
metal
Package metal is the Metal/MPS GPU backend (layer L1b, §T20).
|
Package metal is the Metal/MPS GPU backend (layer L1b, §T20). |
|
npu
Package npu documents GoAI's stance on NPU (neural-processing-unit) acceleration and provides an honest, always-false availability probe (§T44).
|
Package npu documents GoAI's stance on NPU (neural-processing-unit) acceleration and provides an honest, always-false availability probe (§T44). |
|
ref
Package ref is the Pure-Go scalar reference backend (layer L1).
|
Package ref is the Pure-Go scalar reference backend (layer L1). |
|
vulkan
Package vulkan is the optional, portable Vulkan compute GPU backend (layer L1b, §T43).
|
Package vulkan is the optional, portable Vulkan compute GPU backend (layer L1b, §T43). |
|
Package classic implements the classical (pre-deep-learning) machine-learning methods: ordinary least squares, softmax/logistic regression, k-means clustering, and principal component analysis.
|
Package classic implements the classical (pre-deep-learning) machine-learning methods: ordinary least squares, softmax/logistic regression, k-means clustering, and principal component analysis. |
|
Package format is layer L5: model interop and serialization.
|
Package format is layer L5: model interop and serialization. |
|
gguf
Package gguf reads the GGUF file format — the model container used by llama.cpp / ggml for quantized large language models.
|
Package gguf reads the GGUF file format — the model container used by llama.cpp / ggml for quantized large language models. |
|
npy
Package npy reads and writes single arrays in NumPy's .npy format (v1.0), the simplest numpy interchange format — a small ASCII header (dtype, shape, element order) followed by the raw C-order little-endian element bytes.
|
Package npy reads and writes single arrays in NumPy's .npy format (v1.0), the simplest numpy interchange format — a small ASCII header (dtype, shape, element order) followed by the raw C-order little-endian element bytes. |
|
npz
Package npz reads and writes NumPy .npz archives — a ZIP container holding one .npy array per named entry (numpy.savez / numpy.load).
|
Package npz reads and writes NumPy .npz archives — a ZIP container holding one .npy array per named entry (numpy.savez / numpy.load). |
|
safetensors
Package safetensors reads and writes the safetensors file format — the storage container Hugging Face uses for model weights.
|
Package safetensors reads and writes the safetensors file format — the storage container Hugging Face uses for model weights. |
|
internal
|
|
|
bench
Package bench holds deterministic data generators for benchmarks (§T10, §V5).
|
Package bench holds deterministic data generators for benchmarks (§T10, §V5). |
|
benchcompare
Package benchcompare holds cross-backend comparison micro-benchmarks (cpu vs metal vs vulkan vs the pure-Go reference) for the accelerated ops.
|
Package benchcompare holds cross-backend comparison micro-benchmarks (cpu vs metal vs vulkan vs the pure-Go reference) for the accelerated ops. |
|
linalg
Package linalg holds small dense-linear-algebra kernels shared across layers (classic PCA, nn GaLore) — currently a symmetric eigendecomposition.
|
Package linalg holds small dense-linear-algebra kernels shared across layers (classic PCA, nn GaLore) — currently a symmetric eigendecomposition. |
|
npy
Package npy is a minimal Pure-Go reader/writer for NumPy .npy files, used to exchange large golden tensors with the Python reference generator (§T10, §V1).
|
Package npy is a minimal Pure-Go reader/writer for NumPy .npy files, used to exchange large golden tensors with the Python reference generator (§T10, §V1). |
|
simd
Package simd is the internal SIMD wrapper (§B3).
|
Package simd is the internal SIMD wrapper (§B3). |
|
Package linalg provides gonum/numpy-style dense linear algebra over rank-2 tensors: an LU factorization with partial pivoting (P·A = L·U) and the derived determinant, linear solve, and matrix inverse.
|
Package linalg provides gonum/numpy-style dense linear algebra over rank-2 tensors: an LU factorization with partial pivoting (P·A = L·U) and the derived determinant, linear solve, and matrix inverse. |
|
Package llamagpu decodes nlp.Llama models on the GPU with batched command buffers (ADR-0019): each per-token step records the whole layer stack into ONE command buffer over device-resident weights and KV cache, instead of paying a dispatch round-trip per op.
|
Package llamagpu decodes nlp.Llama models on the GPU with batched command buffers (ADR-0019): each per-token step records the whole layer stack into ONE command buffer over device-resident weights and KV cache, instead of paying a dispatch round-trip per op. |
|
Package nlp builds transformer language models — the components that turn a stream of token ids into next-token predictions, and the decoding strategies that turn those predictions back into text.
|
Package nlp builds transformer language models — the components that turn a stream of token ids into next-token predictions, and the decoding strategies that turn those predictions back into text. |
|
Package nn is layer L3: neural-network building blocks.
|
Package nn is layer L3: neural-network building blocks. |
|
Package ops is the eager, functional API over GoAI's tensor operations: each function runs one kernel immediately and returns a new tensor, with no autograd tape involved.
|
Package ops is the eager, functional API over GoAI's tensor operations: each function runs one kernel immediately and returns a new tensor, with no autograd tape involved. |
|
Package rl provides the reinforcement-learning building blocks: episodic environments, return/advantage estimation, and two canonical agents.
|
Package rl provides the reinforcement-learning building blocks: episodic environments, return/advantage estimation, and two canonical agents. |
|
Package tensor is layer L0: the core data model every other layer builds on.
|
Package tensor is layer L0: the core data model every other layer builds on. |
|
Package vision is the L4 computer-vision domain package (§G1/§T457): image models assembled from the verified nn building blocks.
|
Package vision is the L4 computer-vision domain package (§G1/§T457): image models assembled from the verified nn building blocks. |
Click to show internal directories.
Click to hide internal directories.