Core#
Top-level utilities: the lazy-instantiation system that powers every config file, weight-init helpers, QK-norm and rotary embedding primitives, the QuACK-kernel capability probe, and testing helpers.
Lazy configuration#
The lazy-instantiation system lets configs declare _target_-shaped
specs that are deferred until instantiate is called. This is what
every experiment config and most modules/ constructors rely on.
|
Deferred-instantiation config builder. |
|
Instantiate an object from a |
Initialisation helpers#
Truncated-normal and Wang/SmallInit factories used by SIREN, MLP, and projection layers.
|
Truncated-normal initializer with fixed standard deviation. |
|
Factory that returns |
|
Dim-dependent initializer from "Transformers without Tears" (Nguyen & Salazar, 2019). |
|
Depth-scaled initializer (Wang et al.). |
|
Factory that returns |
QK normalization & rotary position embeddings#
Shared building blocks consumed by the attention and Hyena mixers.
|
L2 normalisation layer — learnable-parameter-free, |
|
L2-normalise query and key tensors along a given dimension. |
|
Apply 1D RoPE to a tensor laid out as [batch_size, hidden_dim, seq_len]. |
|
Apply 2D RoPE to a tensor laid out as [batch_size, hidden_dim, H, W]. |
|
Apply 3D RoPE to a tensor laid out as [batch_size, hidden_dim, D, H, W]. |
|
Apply 1D RoPE to a tensor laid out as [batch_size, seq_len, hidden_dim]. |
|
Apply 2D RoPE to a tensor laid out as [batch_size, H, W, hidden_dim]. |
|
Apply 3D RoPE to a tensor laid out as [batch_size, D, H, W, hidden_dim]. |
|
Construct the 1D RoPE cache for a given sequence length and hidden dimension. |
|
Construct the 2D RoPE cache for a given (height, width) and per-axis dimension. |
|
Construct the 3D RoPE cache for given (depth, height, width) and per-axis dimension. |
|
Construct the 1D RoPE cache for a given sequence length and hidden dimension. |
|
Construct the 2D RoPE cache for a given (height, width) and per-axis dimension. |
|
Construct the 3D RoPE cache for given (depth, height, width) and per-axis dimension. |
QuACK capability probe#
|
Return |
Testing helpers#
Small numerical-comparison helpers used by the test suite.
|
Compute relative error between two tensors: ||t1 - t2|| / ||t1||. |