pub struct MLP {
pub gate_proj: Linear,
pub up_proj: Linear,
pub down_proj: Linear,
}Expand description
SwiGLU feed-forward: down(silu(gate(x)) * up(x)).
Fields§
§gate_proj: LinearGate projection (passed through SiLU).
up_proj: LinearUp projection.
down_proj: LinearDown projection back to the hidden size.
Implementations§
Source§impl MLP
impl MLP
Sourcepub fn forward(&self, engine: &ComputeEngine, input: &Tensor) -> Tensor
pub fn forward(&self, engine: &ComputeEngine, input: &Tensor) -> Tensor
Applies the feed-forward to [tokens, hidden] or [batch, seq, hidden].
Sourcepub fn named_params(&self, prefix: &str) -> HashMap<String, Tensor>
pub fn named_params(&self, prefix: &str) -> HashMap<String, Tensor>
Parameters keyed by Hugging Face-style names under prefix.
Sourcepub fn lora_params(&self) -> Vec<Tensor>
pub fn lora_params(&self) -> Vec<Tensor>
Only the LoRA adapter tensors (what LoRA fine-tuning updates).
Auto Trait Implementations§
impl !RefUnwindSafe for MLP
impl !Send for MLP
impl !Sync for MLP
impl !UnwindSafe for MLP
impl Freeze for MLP
impl Unpin for MLP
impl UnsafeUnpin for MLP
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more