Skip to content

Convolution Layers

The k3_node.layers.conv module provides over 65 spatial, spectral, relational, and point-cloud graph convolution layers.


Message Passing Base Class

k3_node.layers.conv.MessagePassing

Bases: Layer

Base class for creating Message Passing Neural Networks (MPNNs).

Parameters:

Name Type Description Default
aggr Union[str, List[str], Aggregation, None]

The aggregation scheme to use, such as "add", "sum", "mean", "min", "max", "mul", or an instance of :class:~k3_node.layers.aggr.Aggregation. (default: "add")

'add'
flow str

The direction of message passing ("source_to_target" or "target_to_source"). (default: "source_to_target")

'source_to_target'
node_dim int

The axis along which to index node features. (default: -2)

-2
decomposed_layers int

Number of decomposed layers for memory-efficient aggregation. (default: 1)

1

aggregate(inputs=None, index=None, ptr=None, dim_size=None, **kwargs)

Aggregates messages from neighbors as given by :obj:index.

call(inputs, edge_index=None, **kwargs)

Default call handler supporting both (x, edge_index) and legacy (inputs,) tuples.

edge_update(**kwargs)

Computes or updates edge attributes.

edge_updater(edge_index, size=None, **kwargs)

Computes or updates edge-level representations.

message(x=None, x_j=None, **kwargs)

Constructs messages from node :math:j to node :math:i.

propagate(*args, **kwargs)

The initial call to start propagating messages.

update(embeddings=None, **kwargs)

Updates node embeddings.


Core Graph Convolutions

GCNConv

k3_node.layers.conv.GCNConv

Bases: MessagePassing

The graph convolutional operator from the "Semi-supervised Classification with Graph Convolutional Networks" <https://arxiv.org/abs/1609.02907>_ paper.

.. math:: \mathbf{X}^{\prime} = \mathbf{\hat{D}}^{-1/2} \mathbf{\hat{A}} \mathbf{\hat{D}}^{-1/2} \mathbf{X} \mathbf{\Theta}

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
improved bool

If set to :obj:True, the layer computes :math:\mathbf{\hat{A}} = \mathbf{A} + 2 \mathbf{I}. (default: :obj:False)

False
cached bool

If set to :obj:True, the layer will cache the computation of :math:\mathbf{\hat{D}}^{-1/2} \mathbf{\hat{A}} \mathbf{\hat{D}}^{-1/2}. (default: :obj:False)

False
add_self_loops bool

If set to :obj:False, will not add self-loops to the input graph. (default: :obj:True)

True
normalize bool

Whether to add self-loops and compute symmetric normalization coefficients on the fly. (default: :obj:True)

True
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: :obj:True)

True

SAGEConv

k3_node.layers.conv.SAGEConv

Bases: MessagePassing

The GraphSAGE operator from the "Inductive Representation Learning on Large Graphs" <https://arxiv.org/abs/1706.02216>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int], None]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels Optional[int]

Size of each output sample.

None
aggr Optional[Union[str, List[str], Aggregation]]

The aggregation scheme to use ("mean", "max", "lstm", etc.). (default: "mean")

'mean'
normalize bool

If set to :obj:True, output features will be :math:\ell_2-normalized. (default: :obj:False)

False
root_weight bool

If set to :obj:False, the layer will not add the transformed root node features. (default: :obj:True)

True
project bool

If set to :obj:True, the layer will apply a linear transformation followed by an activation to source node features. (default: :obj:False)

False
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: :obj:True)

True

GATConv

k3_node.layers.conv.GATConv

Bases: MessagePassing

The graph attentional operator from the "Graph Attention Networks" <https://arxiv.org/abs/1710.10903>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
heads int

Number of multi-head-attentions. (default: 1)

1
concat bool

If set to :obj:False, the multi-head-attentions are averaged instead of concatenated. (default: True)

True
negative_slope float

LeakyReLU angle of the negative slope. (default: 0.2)

0.2
dropout float

Dropout probability of the normalized attention coefficients. (default: 0.0)

0.0
add_self_loops bool

If set to :obj:False, will not add self-loops to the input graph. (default: True)

True
edge_dim Optional[int]

Edge feature dimensionality (in case there are any). (default: :obj:None)

None
fill_value Union[float, str]

The way to generate edge features of self-loops (default: "mean")

'mean'
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True
share_weights bool

If set to :obj:True, the same matrix will be applied to the source and target node features. (default: False)

False
residual bool

If set to :obj:True, will compute residual connections. (default: False)

False

GATv2Conv

k3_node.layers.conv.GATv2Conv

Bases: MessagePassing

The GATv2 operator from the "How Attentive are Graph Attention Networks?" <https://arxiv.org/abs/2105.14491>_ paper, which fixes the static attention problem of standard :class:~k3_node.layers.conv.GATConv.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
heads int

Number of multi-head-attentions. (default: 1)

1
concat bool

If set to :obj:False, the multi-head-attentions are averaged instead of concatenated. (default: True)

True
negative_slope float

LeakyReLU angle of the negative slope. (default: 0.2)

0.2
dropout float

Dropout probability of the normalized attention coefficients. (default: 0.0)

0.0
add_self_loops bool

If set to :obj:False, will not add self-loops to the input graph. (default: True)

True
edge_dim Optional[int]

Edge feature dimensionality (in case there are any). (default: :obj:None)

None
fill_value Union[float, str]

The way to generate edge features of self-loops (default: "mean")

'mean'
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True
share_weights bool

If set to :obj:True, the same matrix will be applied to the source and target node features. (default: False)

False
residual bool

If set to :obj:True, will compute residual connections. (default: False)

False

TransformerConv

k3_node.layers.conv.TransformerConv

Bases: MessagePassing

The graph transformer operator from the "Masked Label Prediction: Unified Meta-Learning on Graph Neural Networks" <https://arxiv.org/abs/2009.03509>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
heads int

Number of multi-head-attentions. (default: 1)

1
concat bool

If set to :obj:False, the multi-head-attentions are averaged instead of concatenated. (default: True)

True
beta bool

If set to :obj:True, will use a gated residual connection. (default: False)

False
dropout float

Dropout probability of the normalized attention coefficients. (default: 0.0)

0.0
edge_dim Optional[int]

Edge feature dimensionality (in case there are any). (default: :obj:None)

None
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True
root_weight bool

If set to :obj:False, the layer will not add the transformed root node features. (default: True)

True

GINConv

k3_node.layers.conv.GINConv

Bases: MessagePassing

The graph isomorphism operator from the "How Powerful are Graph Neural Networks?" <https://arxiv.org/abs/1810.00826>_ paper.

Parameters:

Name Type Description Default
nn Union[Callable, int]

A neural network :math:h_{\mathbf{\Theta}} that maps node features to new embeddings (e.g. a :class:keras.Sequential or callable). Also accepts an integer channels for backward compatibility.

required
eps float

(Initial) :math:\epsilon-value. (default: 0.0)

0.0
train_eps bool

If set to :obj:True, :math:\epsilon will be a learnable parameter. (default: False)

False

GINEConv

k3_node.layers.conv.GINEConv

Bases: MessagePassing

The modified :class:GINConv operator from the "Strategies for Pre-training Graph Neural Networks" <https://arxiv.org/abs/1905.12265>_ paper, which is able to incorporate edge features into aggregation.

Parameters:

Name Type Description Default
nn Callable

A neural network :math:h_{\mathbf{\Theta}}.

required
eps float

(Initial) :math:\epsilon-value. (default: 0.0)

0.0
train_eps bool

If set to :obj:True, :math:\epsilon will be a learnable parameter. (default: False)

False
edge_dim Optional[int]

Edge feature dimensionality. (default: :obj:None)

None

ChebConv

k3_node.layers.conv.ChebConv

Bases: MessagePassing

The Chebyshev spectral graph convolutional operator from the "Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering" <https://arxiv.org/abs/1606.09375>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
K int

Chebyshev filter size :math:K.

required
normalization Optional[str]

The normalization scheme for the graph Laplacian ("sym", "rw" or :obj:None). (default: "sym")

'sym'
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: "True")

True

AGNNConv

k3_node.layers.conv.AGNNConv

Bases: MessagePassing

The graph attentional propagation layer from the "Attention-based Graph Neural Network for Semi-Supervised Learning" <https://arxiv.org/abs/1803.03735>_ paper.

TAGConv

k3_node.layers.conv.TAGConv

Bases: MessagePassing

The topology adaptive graph convolutional operator from the "Topology Adaptive Graph Convolutional Networks" <https://arxiv.org/abs/1710.10370>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
K int

Number of hops :math:K. (default: 3)

3
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True
normalize bool

Whether to apply symmetric normalization. (default: True)

True

ARMAConv

k3_node.layers.conv.ARMAConv

Bases: MessagePassing

The ARMA graph convolutional operator from the "Graph Neural Networks with Convolutional ARMA Filters" <https://arxiv.org/abs/1901.01343>_ paper.

SGConv

k3_node.layers.conv.SGConv

Bases: MessagePassing

The simple graph convolutional operator from the "Simplifying Graph Convolutional Networks" <https://arxiv.org/abs/1902.07153>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
K int

Number of hops :math:K. (default: 1)

1
cached bool

If set to :obj:True, the layer will cache the computation of :math:\mathbf{\hat{D}}^{-1/2} \mathbf{\hat{A}} \mathbf{\hat{D}}^{-1/2}. (default: False)

False
add_self_loops bool

If set to :obj:False, will not add self-loops. (default: True)

True
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True

SSGConv

k3_node.layers.conv.SSGConv

Bases: MessagePassing

The simple spectral graph convolutional operator from the "Simple Spectral Graph Convolution" <https://arxiv.org/abs/2109.07191>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
alpha float

Teleport probability :math:\alpha.

required
K int

Number of hops :math:K. (default: 1)

1
cached bool

If set to :obj:True, the layer will cache normalization coefficients. (default: False)

False
add_self_loops bool

If set to :obj:False, will not add self-loops. (default: True)

True
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True

APPNP

k3_node.layers.conv.APPNP

Bases: MessagePassing

The approximate personalized propagation of neural predictions (APPNP) operator from the "Predict then Propagate: Combining Neural Networks with Personalized PageRank for Classification on Graphs" <https://arxiv.org/abs/1810.05997>_ paper.

Parameters:

Name Type Description Default
K int

Number of iterations :math:K.

required
alpha float

Teleport probability :math:\alpha.

required
dropout float

Dropout probability of edges or features during propagation. (default: 0.0)

0.0
cached bool

If set to :obj:True, the layer will cache the computation of normalization coefficients. (default: False)

False
add_self_loops bool

If set to :obj:False, will not add self-loops. (default: True)

True
normalize bool

Whether to apply symmetric normalization. (default: True)

True

APPNPConv

k3_node.layers.conv.APPNPConv

Bases: Conv

k3_node.layers.APPNPConv Implementation of Approximate Personalized Propagation of Neural Predictions

Parameters:

Name Type Description Default
channels

The number of output channels.

required
alpha

The teleport probability.

0.2
propagations

The number of propagation steps.

1
mlp_hidden

A list of hidden channels for the MLP.

None
mlp_activation

The activation function to use in the MLP.

'relu'
dropout_rate

The dropout rate for the MLP.

0.0
activation

The activation function to use in the layer.

None
use_bias

Whether to add a bias to the linear transformation.

True
kernel_initializer

Initializer for the kernel weights matrix.

'glorot_uniform'
bias_initializer

Initializer for the bias vector.

'zeros'
kernel_regularizer

Regularizer for the kernel weights matrix.

None
bias_regularizer

Regularizer for the bias vector.

None
activity_regularizer

Regularizer for the output.

None
kernel_constraint

Constraint for the kernel weights matrix.

None
bias_constraint

Constraint for the bias vector.

None
**kwargs

Additional keyword arguments.

{}

PNAConv

k3_node.layers.conv.PNAConv

Bases: MessagePassing

The Principal Neighbourhood Aggregation graph convolutional operator from the "Principal Neighbourhood Aggregation for Graph Nets" <https://arxiv.org/abs/2004.05718>_ paper.

GENConv

k3_node.layers.conv.GENConv

Bases: MessagePassing

The generalized graph convolution operator from the "DeeperGCN: All You Need to Train Deeper GCNs" <https://arxiv.org/abs/2006.07739>_ paper.

GatedGraphConv

k3_node.layers.conv.GatedGraphConv

Bases: MessagePassing

k3_node.layers.GatedGraphConv

Implementation of Gated Graph Convolution (GGC) layer

Parameters:

Name Type Description Default
channels

The number of output channels.

None
n_layers

The number of GGC layers to stack.

None
activation

Activation function to use.

None
use_bias

Whether to add a bias to the linear transformation.

True
kernel_initializer

Initializer for the kernel weights matrix.

'glorot_uniform'
bias_initializer

Initializer for the bias vector.

'zeros'
kernel_regularizer

Regularizer for the kernel weights matrix.

None
bias_regularizer

Regularizer for the bias vector.

None
activity_regularizer

Regularizer for the output.

None
kernel_constraint

Constraint for the kernel weights matrix.

None
bias_constraint

Constraint for the bias vector.

None
**kwargs

Additional arguments to pass to the MessagePassing superclass.

{}

ResGatedGraphConv

k3_node.layers.conv.ResGatedGraphConv

Bases: MessagePassing

The residual gated graph convolutional operator from the "Residual Gated Graph ConvNets" <https://arxiv.org/abs/1711.07553>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
act Union[str, Callable]

Activation function :math:\sigma for gating. (default: "sigmoid")

'sigmoid'
edge_dim Optional[int]

Edge feature dimensionality. (default: :obj:None)

None
root_weight bool

If set to :obj:False, will not add transformed root features. (default: True)

True
bias bool

If set to :obj:False, will not learn an additive bias. (default: True)

True

SimpleConv

k3_node.layers.conv.SimpleConv

Bases: MessagePassing

A simple, parameter-free message passing operator.

Parameters:

Name Type Description Default
aggr Union[str, List[str], Aggregation, None]

The aggregation scheme to use ("sum", "mean", "min", "max", "mul"). (default: "sum")

'sum'
combine_root Optional[str]

The way to combine root node features with the aggregated output ("sum", "cat", "self_loop", or :obj:None). (default: :obj:None)

None

GraphConv

k3_node.layers.conv.GraphConv

Bases: MessagePassing

The graph neural network operator from the "Weisfeiler and Leman Go Neural: Higher-order Graph Neural Networks" <https://arxiv.org/abs/1810.02244>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
aggr str

The aggregation scheme to use ("add", "mean", "max"). (default: "add")

'add'
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: "True")

True

MFConv

k3_node.layers.conv.MFConv

Bases: MessagePassing

The molecular fingerprint graph convolutional operator from the "Convolutional Networks on Graphs for Learning Molecular Fingerprints" <https://arxiv.org/abs/1509.09292>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
max_degree int

The maximum degree of any node. (default: 10)

10
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True

Relational & Directed Convolutions

RGCNConv

k3_node.layers.conv.RGCNConv

Bases: MessagePassing

The relational graph convolutional operator from the "Modeling Relational Data with Graph Convolutional Networks" <https://arxiv.org/abs/1703.06103>_ paper.

FastRGCNConv

k3_node.layers.conv.FastRGCNConv

Bases: RGCNConv

See :class:RGCNConv.

RGATConv

k3_node.layers.conv.RGATConv

Bases: MessagePassing

The relational graph attentional operator from the "Relational Graph Attention Networks" <https://arxiv.org/abs/1904.05811>_ paper.

SignedConv

k3_node.layers.conv.SignedConv

Bases: MessagePassing

The signed graph convolutional operator from the "Signed Graph Convolutional Network" <https://arxiv.org/abs/1808.06354>_ paper.

DirGNNConv

k3_node.layers.conv.DirGNNConv

Bases: Layer

A directed graph neural network operator from the "Directed Graph Neural Networks" <https://arxiv.org/abs/2301.07663>_ paper.

AntiSymmetricConv

k3_node.layers.conv.AntiSymmetricConv

Bases: Layer

The anti-symmetric graph convolutional operator from the "Anti-Symmetric DGN: a Continuous approach to Deep Graph Neural Networks" <https://arxiv.org/abs/2202.13085>_ paper.


Advanced & Scaled Graph Convolutions

FiLMConv

k3_node.layers.conv.FiLMConv

Bases: MessagePassing

The FiLM graph convolutional operator from the "GNN-FiLM: Graph Neural Networks with Feature-wise Linear Modulation" <https://arxiv.org/abs/1906.12192>_ paper.

SuperGATConv

k3_node.layers.conv.SuperGATConv

Bases: MessagePassing

The self-supervised graph attentional operator from the "How to Find Your Friendly Neighborhood: Graph Attention Design with Self-Supervision" <https://openreview.net/forum?id=Wi5KUNlqWty>_ paper.

EGConv

k3_node.layers.conv.EGConv

Bases: MessagePassing

The Efficient Graph Convolution from the "Adaptive Filters and Aggregator Fusion for Efficient Graph Convolutions" <https://arxiv.org/abs/2104.01481>_ paper.

MixHopConv

k3_node.layers.conv.MixHopConv

Bases: MessagePassing

The MixHop graph convolutional operator from the "Higher-Order Graph Convolutional Networks via MixHop" <https://arxiv.org/abs/1905.00067>_ paper.

PDNConv

k3_node.layers.conv.PDNConv

Bases: MessagePassing

The pathfinder discovery network convolutional operator from the "Pathfinder Discovery Networks for Neural Message Passing" <https://arxiv.org/abs/2010.12878>_ paper.

FAConv

k3_node.layers.conv.FAConv

Bases: MessagePassing

The Frequency Adaptive Graph Convolution operator from the "Beyond Low-Frequency Information in Graph Convolutional Networks" <https://arxiv.org/abs/2101.00797>_ paper.

PANConv

k3_node.layers.conv.PANConv

Bases: MessagePassing

The path integral based convolution operator from the "Path Integral Based Convolution and Pooling for Graph Neural Networks" <https://arxiv.org/abs/2004.14805>_ paper.

LEConv

k3_node.layers.conv.LEConv

Bases: MessagePassing

The local extremum graph convolutional operator from the "ASAP: Adaptive Structure Aware Pooling for Learning Hierarchical Graph Representations" <https://arxiv.org/abs/1911.07979>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True

ClusterGCNConv

k3_node.layers.conv.ClusterGCNConv

Bases: MessagePassing

The ClusterGCN graph convolutional operator from the "Cluster-GCN: An Efficient Algorithm for Training Deep and Large Graph Convolutional Networks" <https://arxiv.org/abs/1905.07953>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
diag_lambda float

Diagonal enhancement coefficient :math:\lambda. (default: 0.0)

0.0
add_self_loops bool

If set to :obj:False, will not add self-loops. (default: True)

True
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True

GCN2Conv

k3_node.layers.conv.GCN2Conv

Bases: MessagePassing

The graph convolutional operator from the "Simple and Deep Graph Convolutional Networks" <https://arxiv.org/abs/2007.02133>_ paper.

Parameters:

Name Type Description Default
channels int

Size of each input and output sample.

required
alpha float

The strength of the initial residual connection :math:\alpha.

required
theta Optional[float]

The hyperparameter for the identity mapping :math:\theta. (default: :obj:None)

None
layer Optional[int]

The layer index :math:l. (default: :obj:None)

None
shared_weights bool

If set to :obj:True, will use the same weights for :math:\mathbf{X} and :math:\mathbf{X}_0. (default: :obj:True)

True
cached bool

If set to :obj:True, will cache the computation of normalization coefficients. (default: False)

False
add_self_loops bool

If set to :obj:False, will not add self-loops. (default: True)

True
normalize bool

Whether to apply symmetric normalization. (default: True)

True

LGConv

k3_node.layers.conv.LGConv

Bases: MessagePassing

The LightGCN operator from the "LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation" <https://arxiv.org/abs/2002.02126>_ paper.

Parameters:

Name Type Description Default
normalize bool

Whether to apply symmetric normalization. (default: True)

True

NNConv

k3_node.layers.conv.NNConv

Bases: MessagePassing

The continuous kernel-based convolutional operator from the "Neural Message Passing for Quantum Chemistry" <https://arxiv.org/abs/1704.01212>_ paper.

Parameters:

Name Type Description Default
in_channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
out_channels int

Size of each output sample.

required
nn Callable

A neural network :math:h_{\mathbf{\Theta}} that maps edge features to shape :obj:[-1, in_channels * out_channels].

required
aggr str

The aggregation scheme to use ("add", "mean", "max"). (default: "add")

'add'
root_weight bool

If set to :obj:False, the layer will not add the transformed root node features. (default: True)

True
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True

CGConv

k3_node.layers.conv.CGConv

Bases: MessagePassing

The Crystal Graph Convolutional operator from the "Crystal Graph Convolutional Neural Networks for an Accurate and Interpretable Prediction of Material Properties" <https://arxiv.org/abs/1710.10324>_ paper.

Parameters:

Name Type Description Default
channels Union[int, Tuple[int, int]]

Size of each input sample, or a tuple for bipartite graphs.

required
dim int

Edge feature dimensionality. (default: 0)

0
aggr str

The aggregation scheme to use ("add", "mean", "max"). (default: "add")

'add'
batch_norm bool

If set to :obj:True, will apply batch normalization. (default: False)

False
bias bool

If set to :obj:False, the layer will not learn an additive bias. (default: True)

True

EdgeConv

k3_node.layers.conv.EdgeConv

Bases: MessagePassing

The edge convolutional operator from the "Dynamic Graph CNN for Learning on Point Clouds" <https://arxiv.org/abs/1801.07829>_ paper.

Parameters:

Name Type Description Default
nn Callable

A neural network :math:h_{\mathbf{\Theta}} that maps pair-wise node features to new edge representations.

required
aggr str

The aggregation scheme to use ("max", "mean", "sum"). (default: "max")

'max'

DynamicEdgeConv

k3_node.layers.conv.DynamicEdgeConv

Bases: EdgeConv

The dynamic edge convolutional operator from the "Dynamic Graph CNN for Learning on Point Clouds" <https://arxiv.org/abs/1801.07829>_ paper, which dynamically constructs a graph using :math:k-NN at each layer.

Parameters:

Name Type Description Default
nn Callable

A neural network :math:h_{\mathbf{\Theta}}.

required
k int

Number of nearest neighbors. (default: 6)

6
aggr str

The aggregation scheme to use ("max", "mean", "sum"). (default: "max")

'max'
num_workers int

Number of workers (ignored in Keras backend).

1

GeneralConv

k3_node.layers.conv.GeneralConv

Bases: MessagePassing

A general GNN layer adapted from the "Design Space for Graph Neural Networks" <https://arxiv.org/abs/2011.08843>_ paper.


Heterogeneous & Hypergraph Convolutions

HeteroConv

k3_node.layers.conv.HeteroConv

Bases: Layer

A generic wrapper for computing graph convolution on heterogeneous graphs.

Parameters:

Name Type Description Default
convs Dict[Tuple[str, str, str], Layer]

A dictionary holding a bipartite GNN layer for each individual edge type.

required
aggr str

The aggregation scheme to use for grouping node embeddings generated by different relations (:obj:"sum", :obj:"mean", :obj:"min", :obj:"max", :obj:"cat", :obj:None). (default: :obj:"sum")

'sum'

HGTConv

k3_node.layers.conv.HGTConv

Bases: MessagePassing

The Heterogeneous Graph Transformer (HGT) operator from the "Heterogeneous Graph Transformer" <https://arxiv.org/abs/2003.01332>_ paper.

Parameters:

Name Type Description Default
in_channels int or Dict[str, int]

Size of each input sample of every node type.

required
out_channels int

Size of each output sample.

required
metadata Tuple[List[str], List[Tuple[str, str, str]]]

Node types and edge types.

required
heads int

Number of multi-head-attentions. (default: :obj:1)

1

HANConv

k3_node.layers.conv.HANConv

Bases: MessagePassing

The Heterogeneous Graph Attention Operator from the "Heterogeneous Graph Attention Network" <https://arxiv.org/abs/1903.07293>_ paper.

Parameters:

Name Type Description Default
in_channels int or Dict[str, int]

Size of each input sample of every node type.

required
out_channels int

Size of each output sample.

required
metadata Tuple[List[str], List[Tuple[str, str, str]]]

Node types and edge types.

required
heads int

Number of multi-head-attentions. (default: :obj:1)

1
negative_slope float

LeakyReLU angle of the negative slope. (default: :obj:0.2)

0.2

HEATConv

k3_node.layers.conv.HEATConv

Bases: MessagePassing

The heterogeneous edge-enhanced graph attentional operator from the "Heterogeneous Edge-Enhanced Graph Attention Network For Multi-Agent Trajectory Prediction" <https://arxiv.org/abs/2106.07161>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
num_node_types int

The number of node types.

required
num_edge_types int

The number of edge types.

required
edge_type_emb_dim int

The embedding size of edge types.

required
edge_dim int

Edge feature dimensionality.

required
edge_attr_emb_dim int

The embedding size of edge features.

required
heads int

Number of multi-head-attentions. (default: :obj:1)

1
concat bool

Whether to concatenate multi-head attention. (default: :obj:True)

True
negative_slope float

LeakyReLU angle. (default: :obj:0.2)

0.2
root_weight bool

Whether to add root node features. (default: :obj:True)

True
bias bool

Whether to learn an additive bias. (default: :obj:True)

True

HypergraphConv

k3_node.layers.conv.HypergraphConv

Bases: MessagePassing

The hypergraph convolutional operator from the "Hypergraph Convolution and Hypergraph Attention" <https://arxiv.org/abs/1901.08150>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
use_attention bool

Whether to use hypergraph attention. (default: :obj:False)

False
attention_mode str

Attention mode (:obj:"node" or :obj:"edge"). (default: :obj:"node")

'node'
heads int

Number of multi-head-attentions. (default: :obj:1)

1
concat bool

Whether to concatenate heads. (default: :obj:True)

True
negative_slope float

LeakyReLU angle. (default: :obj:0.2)

0.2
bias bool

Whether to learn an additive bias. (default: :obj:True)

True

DNAConv

k3_node.layers.conv.DNAConv

Bases: MessagePassing

The dynamic neighborhood aggregation operator from the "Just Jump: Towards Dynamic Neighborhood Aggregation in Graph Neural Networks" <https://arxiv.org/abs/1904.04849>_ paper.

Parameters:

Name Type Description Default
channels int

Size of each input/output sample.

required
heads int

Number of multi-head-attentions. (default: :obj:1)

1
groups int

Number of groups for linear projections. (default: :obj:1)

1
dropout float

Dropout probability. (default: :obj:0.0)

0.0
cached bool

Whether to cache GCN normalization. (default: :obj:False)

False
normalize bool

Whether to apply symmetric normalization. (default: :obj:True)

True
add_self_loops bool

Whether to add self-loops. (default: :obj:True)

True
bias bool

Whether to learn an additive bias. (default: :obj:True)

True

WLConv

k3_node.layers.conv.WLConv

Bases: Layer

The Weisfeiler Lehman (WL) operator from the "A Reduction of a Graph to a Canonical Form and an Algebra Arising During this Reduction" <https://www.iti.zcu.cz/wl2018/pdf/wl_paper_translation.pdf>_ paper.

Parameters:

Name Type Description Default
**kwargs

Additional layer arguments.

{}

GPSConv

k3_node.layers.conv.GPSConv

Bases: Layer

The general, powerful, scalable (GPS) graph transformer layer from the "Recipe for a General, Powerful, Scalable Graph Transformer" <https://arxiv.org/abs/2205.12454>_ paper.

Parameters:

Name Type Description Default
channels int

Size of each input sample.

required
conv Layer

The local message passing layer.

None
heads int

Number of multi-head-attentions. (default: :obj:1)

1
dropout float

Dropout probability. (default: :obj:0.0)

0.0
act str

Activation function. (default: :obj:"relu")

'relu'
norm str

Normalization function. (default: :obj:"batch_norm")

'batch_norm'

Point Cloud & Geometric Convolutions

PointNetConv

k3_node.layers.conv.PointNetConv

Bases: MessagePassing

The PointNet set abstraction layer from the "PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space" <https://arxiv.org/abs/1706.02413>_ paper.

PointConv

k3_node.layers.conv.PointConv = PointNetConv module-attribute

PointTransformerConv

k3_node.layers.conv.PointTransformerConv

Bases: MessagePassing

The Point Transformer layer from the "Point Transformer" <https://arxiv.org/abs/2012.09164>_ paper.

PointGNNConv

k3_node.layers.conv.PointGNNConv

Bases: MessagePassing

The PointGNN graph convolutional operator from the "Point-GNN: Graph Neural Network for 3D Object Detection in a Point Cloud" <https://arxiv.org/abs/2003.01251>_ paper.

PPFConv

k3_node.layers.conv.PPFConv

Bases: MessagePassing

The PPFNet graph convolutional operator from the "PPFNet: Global Context Aware Local Features for Robust 3D Point Matching" <https://arxiv.org/abs/1802.02669>_ paper.

FeaStConv

k3_node.layers.conv.FeaStConv

Bases: MessagePassing

The (fault-tolerant) feature-steered graph convolution operator from the "FeaStNet: Feature-Steered Graph Convolutions for 3D Shape Analysis" <https://arxiv.org/abs/1706.05206>_ paper.

GMMConv

k3_node.layers.conv.GMMConv

Bases: MessagePassing

The gaussian mixture model convolutional operator from the "Geometric Deep Learning on Graphs and Manifolds using Mixture Model CNNs" <https://arxiv.org/abs/1611.08402>_ paper.

GravNetConv

k3_node.layers.conv.GravNetConv

Bases: MessagePassing

The GravNet operator from the "Learning Representations of Irregular Particle-Detector Geometry with Distance-Weighted Graph Networks" <https://arxiv.org/abs/1902.07987>_ paper.

MeshCNNConv

k3_node.layers.conv.MeshCNNConv

Bases: MessagePassing

The MeshCNN convolutional operator from the "MeshCNN: A Network With An Edge" <https://arxiv.org/abs/1809.05910>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
kernels List[Layer]

A list of 5 neural network layers that transform edge representations. (default: :obj:None)

None

XConv

k3_node.layers.conv.XConv

Bases: Layer

The convolutional operator on :math:\mathcal{X}-transformed points from the "PointCNN: Convolution On X-Transformed Points" <https://arxiv.org/abs/1801.07791>_ paper.

Parameters:

Name Type Description Default
in_channels int

Size of each input sample.

required
out_channels int

Size of each output sample.

required
dim int

Point cloud dimensionality.

required
kernel_size int

Size of the convolving kernel.

required
hidden_channels int

Dimensionality of lifted points.

None
dilation int

Dilation factor. (default: :obj:1)

1
bias bool

Whether to learn an additive bias. (default: :obj:True)

True
num_workers int

Kept for PyG compatibility.

1

SplineConv

k3_node.layers.conv.SplineConv

Bases: MessagePassing

The spline-based convolutional operator from the "SplineCNN: Fast Geometric Deep Learning with Continuous B-Spline Kernels" <https://arxiv.org/abs/1711.08920>_ paper.

Parameters:

Name Type Description Default
in_channels int or tuple

Size of each input sample.

required
out_channels int

Size of each output sample.

required
dim int

Pseudo-coordinate dimensionality.

required
kernel_size int or List[int]

Size of the convolving kernel.

required
is_open_spline bool or List[bool]

If set to :obj:False, uses closed B-spline basis. (default: :obj:True)

True
degree int

B-spline basis degree. (default: :obj:1)

1
aggr str

The aggregation scheme to use (:obj:"mean", :obj:"add", :obj:"max"). (default: :obj:"mean")

'mean'
root_weight bool

Whether to add transformed root node features. (default: :obj:True)

True
bias bool

Whether to learn an additive bias. (default: :obj:True)

True

Spektral-Compatible Convolutions

CrystalConv

k3_node.layers.conv.CrystalConv

Bases: MessagePassing

k3_node.layers.CrystalConv Implementation of Crystal Graph Convolutional Neural Networks (CGCNN) layer

Parameters:

Name Type Description Default
aggregate

Aggregation function to use (one of 'sum', 'mean', 'max').

'sum'
activation

Activation function to use.

None
use_bias

Whether to add a bias to the linear transformation.

True
kernel_initializer

Initializer for the kernel weights matrix.

'glorot_uniform'
bias_initializer

Initializer for the bias vector.

'zeros'
kernel_regularizer

Regularizer for the kernel weights matrix.

None
bias_regularizer

Regularizer for the bias vector.

None
activity_regularizer

Regularizer for the output.

None
kernel_constraint

Constraint for the kernel weights matrix.

None
bias_constraint

Constraint for the bias vector.

None
**kwargs

Additional arguments to pass to the MessagePassing superclass.

{}

DiffusionConv

k3_node.layers.conv.DiffusionConv

Bases: Conv

k3_node.layers.DiffusionConv Implementation of Diffusion Convolutional Neural Networks (DCNN) layer

Parameters:

Name Type Description Default
channels

The number of output channels.

required
K

The number of diffusion steps.

6
activation

Activation function to use.

'tanh'
kernel_initializer

Initializer for the kernel weights matrix.

'glorot_uniform'
kernel_regularizer

Regularizer for the kernel weights matrix.

None
kernel_constraint

Constraint for the kernel weights matrix.

None
**kwargs

Additional arguments to pass to the Conv superclass.

{}

GraphConvolution

k3_node.layers.conv.GraphConvolution

Bases: Layer

k3_node.layers.GraphConvolution Implementation of Graph Convolution (GCN) layer

Parameters:

Name Type Description Default
units

Positive integer, dimensionality of the output space.

required
activation

Activation function to use.

None
use_bias

Whether to add a bias to the linear transformation.

True
final_layer

Deprecated, use tf.gather or GatherIndices instead.

None
input_dim

Deprecated, use keras.layers.Input with input_shape instead.

None
kernel_initializer

Initializer for the kernel weights matrix.

'glorot_uniform'
kernel_regularizer

Regularizer for the kernel weights matrix.

None
kernel_constraint

Constraint for the kernel weights matrix.

None
bias_initializer

Initializer for the bias vector.

'zeros'
bias_regularizer

Regularizer for the bias vector.

None
bias_constraint

Constraint for the bias vector.

None
**kwargs

Additional arguments to pass to the Layer superclass.

{}

GraphAttention

k3_node.layers.conv.GraphAttention

Bases: Layer

k3_node.layers.GraphAttention Implementation of Graph Attention (GAT) layer

Parameters:

Name Type Description Default
units

Positive integer, dimensionality of the output space.

required
attn_heads

Positive integer, number of attention heads.

1
attn_heads_reduction

{'concat', 'average'} Method for reducing attention heads.

'concat'
in_dropout_rate

Dropout rate applied to the input (node features).

0.0
attn_dropout_rate

Dropout rate applied to attention coefficients.

0.0
activation

Activation function to use.

'relu'
use_bias

Whether to add a bias to the linear transformation.

True
final_layer

Deprecated, use tf.gather or GatherIndices instead.

None
saliency_map_support

Whether to support saliency map calculations.

False
kernel_initializer

Initializer for the kernel weights matrix.

'glorot_uniform'
kernel_regularizer

Regularizer for the kernel weights matrix.

None
kernel_constraint

Constraint for the kernel weights matrix.

None
bias_initializer

Initializer for the bias vector.

'zeros'
bias_regularizer

Regularizer for the bias vector.

None
bias_constraint

Constraint for the bias vector.

None
attn_kernel_initializer

Initializer for the attention kernel weights matrix.

'glorot_uniform'
attn_kernel_regularizer

Regularizer for the attention kernel weights matrix.

None
attn_kernel_constraint

Constraint for the attention kernel weights matrix.

None
**kwargs

Additional arguments to pass to the Layer superclass.

{}

PPNPPropagation

k3_node.layers.conv.PPNPPropagation

Bases: Layer

k3_node.layers.PPNPPropagation Implementation of PPNP layer

Parameters:

Name Type Description Default
units

Positive integer, dimensionality of the output space.

required
final_layer

Deprecated, use tf.gather or GatherIndices instead.

None
input_dim

Deprecated, use keras.layers.Input with input_shape instead.

None
**kwargs

Additional arguments to pass to the Layer superclass.

{}