pub struct MoEAttention { /* private fields */ }Expand description
Mixture of Experts attention
Implementations§
Source§impl MoEAttention
impl MoEAttention
Source§impl MoEAttention
impl MoEAttention
pub fn into_reference( val: MoEAttention, env: Env, ) -> Result<Reference<MoEAttention>>
pub fn into_instance(self, env: Env) -> Result<ClassInstance<MoEAttention>>
Source§impl MoEAttention
impl MoEAttention
Sourcepub fn simple(dim: u32, num_experts: u32, top_k: u32) -> Self
pub fn simple(dim: u32, num_experts: u32, top_k: u32) -> Self
Create with simple parameters
§Arguments
dim- Embedding dimensionnum_experts- Number of expert networkstop_k- Number of experts to route to
Sourcepub fn compute(
&self,
query: Float32Array,
keys: Vec<Float32Array>,
values: Vec<Float32Array>,
) -> Result<Float32Array>
pub fn compute( &self, query: Float32Array, keys: Vec<Float32Array>, values: Vec<Float32Array>, ) -> Result<Float32Array>
Compute MoE attention
Sourcepub fn num_experts(&self) -> u32
pub fn num_experts(&self) -> u32
Get the number of experts
Trait Implementations§
Source§impl FromNapiMutRef for MoEAttention
impl FromNapiMutRef for MoEAttention
Source§unsafe fn from_napi_mut_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static mut Self>
unsafe fn from_napi_mut_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static mut Self>
Safety Read more
Source§impl FromNapiRef for MoEAttention
impl FromNapiRef for MoEAttention
Source§unsafe fn from_napi_ref(
env: napi_env,
napi_val: napi_value,
) -> Result<&'static Self>
unsafe fn from_napi_ref( env: napi_env, napi_val: napi_value, ) -> Result<&'static Self>
Safety Read more
Source§impl FromNapiValue for &MoEAttention
impl FromNapiValue for &MoEAttention
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl FromNapiValue for &mut MoEAttention
impl FromNapiValue for &mut MoEAttention
Source§unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
Source§impl ToNapiValue for MoEAttention
impl ToNapiValue for MoEAttention
Source§unsafe fn to_napi_value(env: napi_env, val: MoEAttention) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: MoEAttention) -> Result<napi_value>
Safety Read more
Source§impl TypeName for &MoEAttention
impl TypeName for &MoEAttention
Source§impl TypeName for &mut MoEAttention
impl TypeName for &mut MoEAttention
Source§impl TypeName for MoEAttention
impl TypeName for MoEAttention
Source§impl ValidateNapiValue for &MoEAttention
impl ValidateNapiValue for &MoEAttention
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Source§impl ValidateNapiValue for &mut MoEAttention
impl ValidateNapiValue for &mut MoEAttention
Source§unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
unsafe fn validate(env: napi_env, napi_val: napi_value) -> Result<napi_value>
Safety Read more
Auto Trait Implementations§
impl Freeze for MoEAttention
impl !RefUnwindSafe for MoEAttention
impl Send for MoEAttention
impl Sync for MoEAttention
impl Unpin for MoEAttention
impl UnsafeUnpin for MoEAttention
impl !UnwindSafe for MoEAttention
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