pub struct Qwen2MLP { /* private fields */ }Expand description
Qwen2 MLP with SwiGLU activation.
output = down_proj(SiLU(gate_proj(x)) * up_proj(x))Implementations§
Source§impl Qwen2MLP
impl Qwen2MLP
Sourcepub fn new(hidden_size: usize, intermediate_size: usize) -> Qwen2MLP
pub fn new(hidden_size: usize, intermediate_size: usize) -> Qwen2MLP
Create a new Qwen2 MLP layer.
Sourcepub fn placeholder(hidden_size: usize, intermediate_size: usize) -> Qwen2MLP
pub fn placeholder(hidden_size: usize, intermediate_size: usize) -> Qwen2MLP
Create a placeholder MLP with minimal memory allocation.
Used for lazy initialization when loading pre-trained weights.
Sourcepub fn gate_proj_mut(&mut self) -> &mut Linear
pub fn gate_proj_mut(&mut self) -> &mut Linear
Get mutable reference to gate projection layer.
Sourcepub fn up_proj_mut(&mut self) -> &mut Linear
pub fn up_proj_mut(&mut self) -> &mut Linear
Get mutable reference to up projection layer.
Sourcepub fn down_proj_mut(&mut self) -> &mut Linear
pub fn down_proj_mut(&mut self) -> &mut Linear
Get mutable reference to down projection layer.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Qwen2MLP
impl !UnwindSafe for Qwen2MLP
impl Freeze for Qwen2MLP
impl Send for Qwen2MLP
impl Sync for Qwen2MLP
impl Unpin for Qwen2MLP
impl UnsafeUnpin for Qwen2MLP
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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