pub struct DualSpaceAttention { /* private fields */ }Expand description
Dual-space attention (Euclidean + Hyperbolic)
Implementations§
Source§impl DualSpaceAttention
impl DualSpaceAttention
pub fn into_reference( val: DualSpaceAttention, env: Env, ) -> Result<Reference<DualSpaceAttention>>
pub fn into_instance( self, env: Env, ) -> Result<ClassInstance<DualSpaceAttention>>
Source§impl DualSpaceAttention
impl DualSpaceAttention
Sourcepub fn new(config: DualSpaceConfig) -> Self
pub fn new(config: DualSpaceConfig) -> Self
Sourcepub fn with_weights(
dim: u32,
curvature: f64,
euclidean_weight: f64,
hyperbolic_weight: f64,
) -> Self
pub fn with_weights( dim: u32, curvature: f64, euclidean_weight: f64, hyperbolic_weight: f64, ) -> Self
Create with custom weights
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 dual-space attention
Sourcepub fn get_space_contributions(
&self,
query: Float32Array,
keys: Vec<Float32Array>,
) -> SpaceContributions
pub fn get_space_contributions( &self, query: Float32Array, keys: Vec<Float32Array>, ) -> SpaceContributions
Get space contributions (Euclidean and Hyperbolic scores separately)
Sourcepub fn euclidean_weight(&self) -> f64
pub fn euclidean_weight(&self) -> f64
Get the Euclidean weight
Sourcepub fn hyperbolic_weight(&self) -> f64
pub fn hyperbolic_weight(&self) -> f64
Get the Hyperbolic weight
Trait Implementations§
Source§impl FromNapiMutRef for DualSpaceAttention
impl FromNapiMutRef for DualSpaceAttention
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 DualSpaceAttention
impl FromNapiRef for DualSpaceAttention
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 &DualSpaceAttention
impl FromNapiValue for &DualSpaceAttention
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 DualSpaceAttention
impl FromNapiValue for &mut DualSpaceAttention
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 DualSpaceAttention
impl ObjectFinalize for DualSpaceAttention
Source§impl ToNapiValue for DualSpaceAttention
impl ToNapiValue for DualSpaceAttention
Source§unsafe fn to_napi_value(
env: napi_env,
val: DualSpaceAttention,
) -> Result<napi_value>
unsafe fn to_napi_value( env: napi_env, val: DualSpaceAttention, ) -> Result<napi_value>
Safety Read more
Source§impl TypeName for &DualSpaceAttention
impl TypeName for &DualSpaceAttention
Source§impl TypeName for &mut DualSpaceAttention
impl TypeName for &mut DualSpaceAttention
Source§impl TypeName for DualSpaceAttention
impl TypeName for DualSpaceAttention
Source§impl ValidateNapiValue for &DualSpaceAttention
impl ValidateNapiValue for &DualSpaceAttention
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 DualSpaceAttention
impl ValidateNapiValue for &mut DualSpaceAttention
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 DualSpaceAttention
impl RefUnwindSafe for DualSpaceAttention
impl Send for DualSpaceAttention
impl Sync for DualSpaceAttention
impl Unpin for DualSpaceAttention
impl UnsafeUnpin for DualSpaceAttention
impl UnwindSafe for DualSpaceAttention
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