Simplicial Attention Network (SAN) implementation for binary edge classification.

class topomodelx.nn.simplicial.san.SAN(in_channels, hidden_channels, out_channels=None, n_filters=2, order_harmonic=5, epsilon_harmonic=0.1, n_layers=2)[source]#

Simplicial Attention Network (SAN) implementation for binary edge classification.

Parameters:
in_channelsint

Dimension of input features.

hidden_channelsint

Dimension of hidden features.

out_channelsint

Dimension of output features.

n_filtersint, default = 2

Approximation order for simplicial filters.

order_harmonicint, default = 5

Approximation order for harmonic convolution.

epsilon_harmonicfloat, default = 1e-1

Epsilon value for harmonic convolution.

n_layersint, default = 2

Number of message passing layers.

compute_projection_matrix(laplacian)[source]#

Compute the projection matrix.

The matrix is used to calculate the harmonic component in SAN layers.

Parameters:
laplaciantorch.Tensor, shape = (n_edges, n_edges)

Hodge laplacian of rank 1.

Returns:
torch.Tensor, shape = (n_edges, n_edges)

Projection matrix.

forward(x, laplacian_up, laplacian_down)[source]#

Forward computation.

Parameters:
xtorch.Tensor, shape = (n_nodes, channels_in)

Node features.

laplacian_uptorch.Tensor, shape = (n_edges, n_edges)

Upper laplacian of rank 1.

laplacian_downtorch.Tensor, shape = (n_edges, n_edges)

Down laplacian of rank 1.

Returns:
torch.Tensor, shape = (n_edges, out_channels)

Final hidden representations of edges.