pub struct LayerWeights {
pub input_norm: Vec<f32>,
pub post_norm: Vec<f32>,
pub attn_out_norm: Option<Vec<f32>>,
pub layer_scale: Option<f32>,
pub ffn_out_norm: Option<Vec<f32>>,
pub ffn: FfnKind,
pub attn: AttnKind,
}Expand description
One transformer layer: shared norms + MLP, attention by kind.
Fields§
§input_norm: Vec<f32>§post_norm: Vec<f32>The pre-FFN norm (post_attention_layernorm classically;
pre_feedforward_layernorm on Gemma-2/3 sandwich layers).
attn_out_norm: Option<Vec<f32>>Gemma-2/3 sandwich: norm applied to the ATTENTION OUTPUT before
its residual add (post_attention_layernorm there).
layer_scale: Option<f32>Gemma-4: the whole layer output is multiplied by this scalar.
ffn_out_norm: Option<Vec<f32>>Gemma-2/3 sandwich: norm applied to the FFN OUTPUT before its
residual add (post_feedforward_layernorm).
ffn: FfnKind§attn: AttnKindAuto Trait Implementations§
impl !Freeze for LayerWeights
impl !RefUnwindSafe for LayerWeights
impl !Sync for LayerWeights
impl Send for LayerWeights
impl Unpin for LayerWeights
impl UnsafeUnpin for LayerWeights
impl UnwindSafe for LayerWeights
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