deephyper.keras.layers.AttentionLinear
deephyper.keras.layers.AttentionLinear#
-
class
deephyper.keras.layers.
AttentionLinear
(*args: Any, **kwargs: Any)[source]# Bases:
tensorflow.keras.layers.
Linear Attention.
The attention coefficient between node \(i\) and \(j\) is calculated as:
\[\text{tanh} (\textbf{a}_l\textbf{Wh}_i + \textbf{a}_r\textbf{Wh}_j)\]where \(\textbf{a}_l\) and \(\textbf{a}_r\) are trainable vectors.
- Parameters
Methods
build
Apply the layer on input tensors.
-
__call__
(*args: Any, **kwargs: Any) → Any# Call self as a function.
-
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)