gammagl.layers.conv.MGNNI_m_iter¶
- class MGNNI_m_iter(m, k, threshold, max_iter, gamma, layer_norm=False)[source]¶
The mgnni operator from the “Multiscale Graph Neural Networks with Implicit Layers” paper
\[Z^{(l+1)} =\gamma g(F)Z^{(l)}S^{(m)}+f(X;G)\]where :math gamma denotes the contraction factor, :math m denotes a hyperparameter for graph scale(i.e., the power of adjacency matrix) and :math f(X;G) is a parameterized transformation on input features and graphs, the normalized weight matrix \(g(F)\) are computed as
\[g(F) =\frac{1}{\|F^\top F\|_\text{F}+\epsilon_F}F^\top F\]- Parameters:
m (int) – Size of each input sample to derive the size from the first input(s) to the forward method.
k (int) – The power of adjacency matrix. The greater the k, the further the distance to capture the information
threshold (int) – Threshold for convergence. Convergence is considered when the difference between the two times is less than this threshold
max_iter (int) – Maximum number of iterative solver iterations
gamma (float) – The contraction factor. The smaller the gamma, the faster the contraction, the smaller the capture range; the larger the gamma, the larger the capture range, but it is difficult to converge and inefficient
layer_norm (bool, optional) – whether to use layer norm. (default:
False)
- forward(X, edge_index, edge_weight, num_nodes)[source]¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.