deephyper.keras.layers.AttentionGCN#
- class deephyper.keras.layers.AttentionGCN(*args: Any, **kwargs: Any)[source]#
Bases:
Layer
GCN Attention.
The attention coefficient between node \(i\) and \(j\) is calculated as:
\[\frac{1}{\sqrt{|\mathcal{N}(i)||\mathcal{N}(j)|}}\]where \(\mathcal{N}(i)\) is the number of neighboring nodes of node \(i\).
- Parameters:
Methods
Apply the layer on input tensors.
- call(inputs, **kwargs)[source]#
Apply the layer on input tensors.
- Parameters:
inputs (list) – X (tensor): node feature tensor N (int): number of nodes targets (tensor): target node index tensor sources (tensor): source node index tensor degree (tensor): node degree sqrt tensor (for GCN attention)
- Returns:
attention coefficient tensor
- Return type:
attn_coef (tensor)