pub struct HyperbolicAttention { /* private fields */ }Expand description
Hyperbolic attention in Poincaré ball model
Implementations§
Source§impl HyperbolicAttention
impl HyperbolicAttention
pub fn into_reference( val: HyperbolicAttention, env: Env, ) -> Result<Reference<HyperbolicAttention>>
pub fn into_instance( self, env: Env, ) -> Result<ClassInstance<HyperbolicAttention>>
Source§impl HyperbolicAttention
impl HyperbolicAttention
Sourcepub fn new(dim: u32, curvature: f64) -> Self
pub fn new(dim: u32, curvature: f64) -> Self
Create a new hyperbolic attention instance
§Arguments
dim- Embedding dimensioncurvature- Hyperbolic curvature (typically 1.0)
Sourcepub fn with_config(
dim: u32,
curvature: f64,
adaptive_curvature: bool,
temperature: f64,
) -> Self
pub fn with_config( dim: u32, curvature: f64, adaptive_curvature: bool, temperature: f64, ) -> Self
Create with full configuration
§Arguments
dim- Embedding dimensioncurvature- Hyperbolic curvatureadaptive_curvature- Whether to use adaptive curvaturetemperature- Temperature for softmax
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 hyperbolic attention
Trait Implementations§
Source§impl FromNapiMutRef for HyperbolicAttention
impl FromNapiMutRef for HyperbolicAttention
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 HyperbolicAttention
impl FromNapiRef for HyperbolicAttention
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 &HyperbolicAttention
impl FromNapiValue for &HyperbolicAttention
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 HyperbolicAttention
impl FromNapiValue for &mut HyperbolicAttention
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 HyperbolicAttention
impl ObjectFinalize for HyperbolicAttention
Source§impl ToNapiValue for HyperbolicAttention
impl ToNapiValue for HyperbolicAttention
Source§unsafe fn to_napi_value(
env: napi_env,
val: HyperbolicAttention,
) -> Result<napi_value>
unsafe fn to_napi_value( env: napi_env, val: HyperbolicAttention, ) -> Result<napi_value>
Safety Read more
Source§impl TypeName for &HyperbolicAttention
impl TypeName for &HyperbolicAttention
Source§impl TypeName for &mut HyperbolicAttention
impl TypeName for &mut HyperbolicAttention
Source§impl TypeName for HyperbolicAttention
impl TypeName for HyperbolicAttention
Source§impl ValidateNapiValue for &HyperbolicAttention
impl ValidateNapiValue for &HyperbolicAttention
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 HyperbolicAttention
impl ValidateNapiValue for &mut HyperbolicAttention
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 HyperbolicAttention
impl RefUnwindSafe for HyperbolicAttention
impl Send for HyperbolicAttention
impl Sync for HyperbolicAttention
impl Unpin for HyperbolicAttention
impl UnsafeUnpin for HyperbolicAttention
impl UnwindSafe for HyperbolicAttention
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