pub struct GraphVAE { /* private fields */ }Expand description
Graph Variational Autoencoder (GraphVAE) Learns a probabilistic latent representation of graphs
Implementations§
Source§impl GraphVAE
impl GraphVAE
Sourcepub fn new(
in_features: usize,
hidden_features: usize,
latent_dim: usize,
beta: f32,
use_bias: bool,
) -> Self
pub fn new( in_features: usize, hidden_features: usize, latent_dim: usize, beta: f32, use_bias: bool, ) -> Self
Create a new Graph Variational Autoencoder
Sourcepub fn encode(&self, graph: &GraphData) -> (Tensor, Tensor)
pub fn encode(&self, graph: &GraphData) -> (Tensor, Tensor)
Encode graph to latent distribution parameters
Sourcepub fn reparameterize(&self, mu: &Tensor, logvar: &Tensor) -> Tensor
pub fn reparameterize(&self, mu: &Tensor, logvar: &Tensor) -> Tensor
Reparameterization trick for sampling from latent distribution
Sourcepub fn decode(&self, z: &Tensor, num_nodes: usize) -> GraphData
pub fn decode(&self, z: &Tensor, num_nodes: usize) -> GraphData
Decode latent representation to graph
Sourcepub fn forward(&self, graph: &GraphData) -> (GraphData, Tensor, Tensor)
pub fn forward(&self, graph: &GraphData) -> (GraphData, Tensor, Tensor)
Forward pass through GraphVAE
Sourcepub fn compute_loss(
&self,
graph: &GraphData,
reconstructed: &GraphData,
mu: &Tensor,
logvar: &Tensor,
) -> f32
pub fn compute_loss( &self, graph: &GraphData, reconstructed: &GraphData, mu: &Tensor, logvar: &Tensor, ) -> f32
Compute VAE loss (reconstruction + KL divergence)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for GraphVAE
impl RefUnwindSafe for GraphVAE
impl Send for GraphVAE
impl Sync for GraphVAE
impl Unpin for GraphVAE
impl UnsafeUnpin for GraphVAE
impl UnwindSafe for GraphVAE
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
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