pub struct DotProductAttention { /* private fields */ }Expand description
Scaled dot-product attention
Implementations§
Source§impl DotProductAttention
impl DotProductAttention
pub fn into_reference( val: DotProductAttention, env: Env, ) -> Result<Reference<DotProductAttention>>
pub fn into_instance( self, env: Env, ) -> Result<ClassInstance<DotProductAttention>>
Source§impl DotProductAttention
impl DotProductAttention
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 attention output
§Arguments
query- Query vectorkeys- Array of key vectorsvalues- Array of value vectors
Sourcepub fn compute_with_mask(
&self,
query: Float32Array,
keys: Vec<Float32Array>,
values: Vec<Float32Array>,
mask: Vec<bool>,
) -> Result<Float32Array>
pub fn compute_with_mask( &self, query: Float32Array, keys: Vec<Float32Array>, values: Vec<Float32Array>, mask: Vec<bool>, ) -> Result<Float32Array>
Compute attention with mask
§Arguments
query- Query vectorkeys- Array of key vectorsvalues- Array of value vectorsmask- Boolean mask array (true = attend, false = mask)
Trait Implementations§
Source§impl FromNapiMutRef for DotProductAttention
impl FromNapiMutRef for DotProductAttention
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 DotProductAttention
impl FromNapiRef for DotProductAttention
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 &DotProductAttention
impl FromNapiValue for &DotProductAttention
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 DotProductAttention
impl FromNapiValue for &mut DotProductAttention
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 ObjectFinalize for DotProductAttention
impl ObjectFinalize for DotProductAttention
Source§impl ToNapiValue for DotProductAttention
impl ToNapiValue for DotProductAttention
Source§unsafe fn to_napi_value(
env: napi_env,
val: DotProductAttention,
) -> Result<napi_value>
unsafe fn to_napi_value( env: napi_env, val: DotProductAttention, ) -> Result<napi_value>
Safety Read more
Source§impl TypeName for &DotProductAttention
impl TypeName for &DotProductAttention
Source§impl TypeName for &mut DotProductAttention
impl TypeName for &mut DotProductAttention
Source§impl TypeName for DotProductAttention
impl TypeName for DotProductAttention
Source§impl ValidateNapiValue for &DotProductAttention
impl ValidateNapiValue for &DotProductAttention
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 DotProductAttention
impl ValidateNapiValue for &mut DotProductAttention
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 DotProductAttention
impl RefUnwindSafe for DotProductAttention
impl Send for DotProductAttention
impl Sync for DotProductAttention
impl Unpin for DotProductAttention
impl UnsafeUnpin for DotProductAttention
impl UnwindSafe for DotProductAttention
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