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,
},
}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.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Op
Auto Trait Implementations§
impl Freeze for Op
impl RefUnwindSafe for Op
impl Send for Op
impl Sync for Op
impl Unpin for Op
impl UnsafeUnpin for Op
impl UnwindSafe for Op
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more