pub struct MixtureOfExperts { /* private fields */ }Expand description
Mixture of Experts layer
Implementations§
Source§impl MixtureOfExperts
impl MixtureOfExperts
Sourcepub fn new(
config: MoEConfig,
d_model: usize,
d_ff: usize,
) -> Result<Self, String>
pub fn new( config: MoEConfig, d_model: usize, d_ff: usize, ) -> Result<Self, String>
Create new MoE layer
Sourcepub fn get_aux_loss(&self) -> f32
pub fn get_aux_loss(&self) -> f32
Get auxiliary loss
Sourcepub fn get_expert_usage(&self) -> &[usize]
pub fn get_expert_usage(&self) -> &[usize]
Get expert usage statistics
Sourcepub fn reset_usage_stats(&mut self)
pub fn reset_usage_stats(&mut self)
Reset expert usage statistics
Sourcepub fn load_balance_factor(&self) -> f32
pub fn load_balance_factor(&self) -> f32
Get load balance factor (1.0 = perfect balance)
Auto Trait Implementations§
impl Freeze for MixtureOfExperts
impl !RefUnwindSafe for MixtureOfExperts
impl Send for MixtureOfExperts
impl Sync for MixtureOfExperts
impl Unpin for MixtureOfExperts
impl !UnwindSafe for MixtureOfExperts
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