pub struct SiameseGraphNetwork { /* private fields */ }Expand description
Siamese Graph Network for similarity learning
Implementations§
Source§impl SiameseGraphNetwork
impl SiameseGraphNetwork
Sourcepub fn new(
input_dim: usize,
hidden_dim: usize,
output_dim: usize,
) -> Result<Self, TorshError>
pub fn new( input_dim: usize, hidden_dim: usize, output_dim: usize, ) -> Result<Self, TorshError>
Create a new Siamese graph network
Sourcepub fn embed(&self, graph: &GraphData) -> Result<Tensor, TorshError>
pub fn embed(&self, graph: &GraphData) -> Result<Tensor, TorshError>
Compute embeddings for a graph
Sourcepub fn contrastive_loss(
&self,
graph1: &GraphData,
graph2: &GraphData,
is_similar: bool,
margin: f32,
) -> Result<f32, TorshError>
pub fn contrastive_loss( &self, graph1: &GraphData, graph2: &GraphData, is_similar: bool, margin: f32, ) -> Result<f32, TorshError>
Compute contrastive loss between similar and dissimilar pairs
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SiameseGraphNetwork
impl RefUnwindSafe for SiameseGraphNetwork
impl Send for SiameseGraphNetwork
impl Sync for SiameseGraphNetwork
impl Unpin for SiameseGraphNetwork
impl UnsafeUnpin for SiameseGraphNetwork
impl UnwindSafe for SiameseGraphNetwork
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more