torch_geometric_signed_directed.nn.signed.SNEAConv
Classes
The signed graph attentional layers operator from the `"Learning Signed |
Module Contents
- class SNEAConv(in_dim: int, out_dim: int, first_aggr: bool, bias: bool = True, norm_emb: bool = True, add_self_loops=True, **kwargs)
Bases:
torch_geometric.nn.conv.MessagePassingThe signed graph attentional layers operator from the “Learning Signed Network Embedding via Graph Attention” paper
\[ \begin{align}\begin{aligned}\mathbf{h}_{i}^{\mathcal{B}(l)}=\tanh \left(\sum_{j \in \hat{\mathcal{N}}_{i}^{+}, k \in \mathcal{N}_{i}^{-}} \alpha_{i j}^{\mathcal{B}(l)} \mathbf{h}_{j}^{\mathcal{B}(l-1)} \mathbf{W}^{\mathcal{B}(l)} +\alpha_{i k}^{\mathcal{B}(l)} \mathbf{h}_{k}^{\mathcal{U}(l-1)} \mathbf{W}^{\mathcal{B}(l)}\right)\\\mathbf{h}_{i}^{\mathcal{U}(l)}=\tanh \left(\sum_{j \in \hat{\mathcal{N}}_{i}^{+}, k \in \mathcal{N}_{i}^{-}} \alpha_{i j}^{\mathcal{U}(l)} \mathbf{h}_{j}^{\mathcal{U}(l-1)} \mathbf{W}^{\mathcal{U}(l)} +\alpha_{i k}^{\mathcal{U}(l)} \mathbf{h}_{k}^{\mathcal{B}(l-1)} \mathbf{W}^{\mathcal{U}(l)}\right)\end{aligned}\end{align} \]In case
first_aggrisFalse, the layer expectsxto be a tensor wherex[:, :in_dim]denotes the positive node features \(\mathbf{X}^{(\textrm{pos})}\) andx[:, in_dim:]denotes the negative node features \(\mathbf{X}^{(\textrm{neg})}\).- Parameters:
in_dim (int or 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_dim (int) – Size of each output sample.
first_aggr (bool) – Denotes which aggregation formula to use.
bias (bool, optional) – If set to
False, the layer will not learn an additive bias. (default:True)**kwargs (optional) – Additional arguments of
torch_geometric.nn.conv.MessagePassing.
- in_dim
- out_dim
- first_aggr
- add_self_loops = True
- norm_emb = True
- lin_b
- lin_u
- alpha_u
- alpha_b
- reset_parameters()
- forward(x: torch.Tensor | torch_geometric.typing.PairTensor, pos_edge_index: torch.LongTensor, neg_edge_index: torch.LongTensor)