Expand description
Element-wise vector ops (add / Hadamard / scale / axpy) — residual stream + gated activations.
Dynamic element-wise vector operations — the foundational rank-1 linear algebra the
transformer is built from beyond GEMM: the residual connection (x + sublayer(x)) is
vector addition, and the gated activation (SwiGLU) uses the Hadamard product
(element-wise multiply). Plain arithmetic; caller-owned, zero allocation.
Functions§
- add_
assign a[i] += b[i]— in-place residual add.- add_
into c[i] = a[i] + b[i]— vector addition (the residual connectionx + sublayer(x)).- axpy
y[i] += α·x[i]— the BLASaxpy.- hadamard_
assign a[i] *= b[i]— in-place Hadamard product.- hadamard_
into c[i] = a[i] · b[i]— the Hadamard (element-wise) product, e.g. the SwiGLU gatesilu(g) ⊙ u.- scale
a[i] *= s— scalar scaling.