CWN#

CWN class.

class topomodelx.nn.cell.cwn.CWN(in_channels_0, in_channels_1, in_channels_2, hid_channels, n_layers, **kwargs)[source]#

Implementation of a specific version of CW network [1].

Parameters:
in_channels_0int

Dimension of input features on nodes (0-cells).

in_channels_1int

Dimension of input features on edges (1-cells).

in_channels_2int

Dimension of input features on faces (2-cells).

hid_channelsint

Dimension of hidden features.

n_layersint

Number of CWN layers.

**kwargsoptional

Additional arguments CWNLayer.

References

[1]

Bodnar, et al. Weisfeiler and Lehman go cellular: CW networks. NeurIPS 2021. https://arxiv.org/abs/2106.12575

forward(x_0, x_1, x_2, adjacency_0, incidence_2, incidence_1_t)[source]#

Forward computation through projection, convolutions, linear layers and average pooling.

Parameters:
x_0torch.Tensor, shape = (n_nodes, in_channels_0)

Input features on the nodes (0-cells).

x_1torch.Tensor, shape = (n_edges, in_channels_1)

Input features on the edges (1-cells).

x_2torch.Tensor, shape = (n_faces, in_channels_2)

Input features on the faces (2-cells).

adjacency_0torch.Tensor, shape = (n_edges, n_edges)

Upper-adjacency matrix of rank 1.

incidence_2torch.Tensor, shape = (n_edges, n_faces)

Boundary matrix of rank 2.

incidence_1_ttorch.Tensor, shape = (n_edges, n_nodes)

Coboundary matrix of rank 1.

Returns:
x_0torch.Tensor, shape = (n_nodes, in_channels_0)

Final hidden states of the nodes (0-cells).

x_1torch.Tensor, shape = (n_edges, in_channels_1)

Final hidden states the edges (1-cells).

x_2torch.Tensor, shape = (n_edges, in_channels_2)

Final hidden states of the faces (2-cells).