pub struct RuvectorLayer { /* private fields */ }Expand description
Graph Neural Network layer for HNSW topology
Implementations§
Source§impl RuvectorLayer
impl RuvectorLayer
Source§impl RuvectorLayer
impl RuvectorLayer
pub fn into_reference( val: RuvectorLayer, env: Env, ) -> Result<Reference<RuvectorLayer>>
pub fn into_instance(self, env: Env) -> Result<ClassInstance<RuvectorLayer>>
Source§impl RuvectorLayer
impl RuvectorLayer
Sourcepub fn forward(
&self,
node_embedding: Float32Array,
neighbor_embeddings: Vec<Float32Array>,
edge_weights: Float32Array,
) -> Result<Float32Array>
pub fn forward( &self, node_embedding: Float32Array, neighbor_embeddings: Vec<Float32Array>, edge_weights: Float32Array, ) -> Result<Float32Array>
Forward pass through the GNN layer
§Arguments
node_embedding- Current node’s embedding (Float32Array)neighbor_embeddings- Embeddings of neighbor nodes (Array of Float32Array)edge_weights- Weights of edges to neighbors (Float32Array)
§Returns
Updated node embedding as Float32Array
§Example
const node = new Float32Array([1.0, 2.0, 3.0, 4.0]);
const neighbors = [new Float32Array([0.5, 1.0, 1.5, 2.0]), new Float32Array([2.0, 3.0, 4.0, 5.0])];
const weights = new Float32Array([0.3, 0.7]);
const output = layer.forward(node, neighbors, weights);Trait Implementations§
Source§impl FromNapiMutRef for RuvectorLayer
impl FromNapiMutRef for RuvectorLayer
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 RuvectorLayer
impl FromNapiRef for RuvectorLayer
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 &RuvectorLayer
impl FromNapiValue for &RuvectorLayer
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 RuvectorLayer
impl FromNapiValue for &mut RuvectorLayer
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 RuvectorLayer
impl ToNapiValue for RuvectorLayer
Source§unsafe fn to_napi_value(env: napi_env, val: RuvectorLayer) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: RuvectorLayer) -> Result<napi_value>
Safety Read more
Source§impl TypeName for &RuvectorLayer
impl TypeName for &RuvectorLayer
Source§impl TypeName for &mut RuvectorLayer
impl TypeName for &mut RuvectorLayer
Source§impl TypeName for RuvectorLayer
impl TypeName for RuvectorLayer
Source§impl ValidateNapiValue for &RuvectorLayer
impl ValidateNapiValue for &RuvectorLayer
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 RuvectorLayer
impl ValidateNapiValue for &mut RuvectorLayer
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 RuvectorLayer
impl RefUnwindSafe for RuvectorLayer
impl Send for RuvectorLayer
impl Sync for RuvectorLayer
impl Unpin for RuvectorLayer
impl UnwindSafe for RuvectorLayer
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