pub enum Op {
Embed {
table: W,
out: Val,
},
LayerNorm {
x: Val,
w: W,
b: Option<W>,
eps: f64,
out: Val,
},
Gemm {
a: Val,
w: W,
b: Option<W>,
epilogue: Epilogue,
out: Val,
},
Rope {
qkv: Val,
theta: f64,
},
Attention {
qkv: Val,
window: Option<usize>,
out: Val,
},
GeGlu {
x: Val,
out: Val,
},
AddType {
h: Val,
table: W,
},
GatherMarkers {
h: Val,
out: Val,
},
ActFeatures {
h: Val,
logits: Val,
out: Val,
},
MeanPool {
h: Val,
out: Val,
},
}Expand description
One step of a graph. Every op runs on the rows the batch has, not the bucket’s padded count.
Variants§
Embed
out[i] = table[ids[i]], token rows.
LayerNorm
LayerNorm over each row, statistics in f64.
Fields
Gemm
out = epilogue(a wᵀ + b) with w as [n, k].
Fields
Rope
Rotary embedding applied in place to the q and k parts of fused [q | k | v] rows, with
positions counted from the start of each sequence.
Attention
Self attention within each sequence over fused [q | k | v] rows.
Fields
GeGlu
out = gelu(x[:, ..n]) * x[:, n..] with x twice as wide as out.
AddType
Adds table[qtype[s]] to every row of sequence s, in place.
GatherMarkers
The row of each marker.
ActFeatures
Per sequence, its first row followed by [top1, top1 - top2, entropy / ln k, k / 255] over
the softmax of its markers’ logits, Laya’s act head input.
Fields
MeanPool
Per sequence, the mean of its token rows, Laya’s embed_fn_from_agent pooling.