gammagl.layers.conv.GMMConv¶
- class GMMConv(in_channels, out_channels, dim, n_kernels, aggr='sum', add_bias=True)[source]¶
The Gaussian Mixture Model Convolution or MoNet operator from the “Geometric deep learning on graphs and manifolds using mixture model CNNs” paper
\[ \begin{align}\begin{aligned}u_{ij} &= f(x_i, x_j), x_j \in \mathcal{N}(i)\\w_k(u) &= \exp\left(-\frac{1}{2}(u-\mu_k)^T \Sigma_k^{-1} (u - \mu_k)\right)\\h_i^{l+1} &= \mathrm{aggregate}\left(\left\{\frac{1}{K} \sum_{k}^{K} w_k(u_{ij}), \forall j\in \mathcal{N}(i)\right\}\right)\end{aligned}\end{align} \]where \(u\) denotes the pseudo-coordinates between a vertex and one of its neighbor, computed using function \(f\), \(\Sigma_k^{-1}\) and \(\mu_k\) are learnable parameters representing the covariance matrix and mean vector of a Gaussian kernel.
- Parameters:
in_channels (int, tuple) – Size of each input sample, or
-1to derive the size from the first input(s) to the forward method. A tuple corresponds to the sizes of source and target dimensionalities.out_channels (int) – Size of each output sample.
dim (int) – Dimensionality of pseudo-coordinte; i.e, the number of dimensions of \(u_{ij}\).
n_kernels (int) – Number of kernels \(K\).
aggregator_type (str) – Aggregator type (
sum,mean,max). Default:sum.add_bias (bool) – If True, adds a learnable bias to the output. Default:
True.
- forward(x, edge_index, pseudo=None)[source]¶
Compute Gaussian Mixture Model Convolution layer.
- Parameters:
x (tensor) – The input node features.
pseudo (tensor) – The pseudo coordinate tensor of shape \((E, D_{u})\) where \(E\) is the number of edges of the graph and \(D_{u}\) is the dimensionality of pseudo coordinate.
- Returns:
The output feature of shape \((N, D_{out})\) where \(D_{out}\) is the output feature size.
- Return type:
tensor