pub struct GraphConvolution { /* private fields */ }Expand description
Graph Convolutional Network (GCN) layer
Implements the GCN operation: H^(l+1) = σ(D^(-1/2) A D^(-1/2) H^(l) W^(l)) where A is the adjacency matrix, D is the degree matrix, H is node features, W is weights
Implementations§
Source§impl GraphConvolution
impl GraphConvolution
Sourcepub fn new(
in_features: usize,
out_features: usize,
use_bias: bool,
add_self_loops: bool,
normalize: bool,
) -> TorshResult<Self>
pub fn new( in_features: usize, out_features: usize, use_bias: bool, add_self_loops: bool, normalize: bool, ) -> TorshResult<Self>
Create a new graph convolution layer
Sourcepub fn forward(
&self,
node_features: &Tensor,
adjacency: &CsrTensor,
) -> TorshResult<Tensor>
pub fn forward( &self, node_features: &Tensor, adjacency: &CsrTensor, ) -> TorshResult<Tensor>
Forward pass through the graph convolution layer
Sourcepub fn num_parameters(&self) -> usize
pub fn num_parameters(&self) -> usize
Get the number of parameters
Sourcepub fn in_features(&self) -> usize
pub fn in_features(&self) -> usize
Get input feature dimension
Sourcepub fn out_features(&self) -> usize
pub fn out_features(&self) -> usize
Get output feature dimension
Auto Trait Implementations§
impl !Freeze for GraphConvolution
impl RefUnwindSafe for GraphConvolution
impl Send for GraphConvolution
impl Sync for GraphConvolution
impl Unpin for GraphConvolution
impl UnsafeUnpin for GraphConvolution
impl UnwindSafe for GraphConvolution
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