torch_geometric_signed_directed.nn.signed.SNEAConv ================================================== .. py:module:: torch_geometric_signed_directed.nn.signed.SNEAConv Classes ------- .. autoapisummary:: torch_geometric_signed_directed.nn.signed.SNEAConv.SNEAConv Module Contents --------------- .. py:class:: SNEAConv(in_dim: int, out_dim: int, first_aggr: bool, bias: bool = True, norm_emb: bool = True, add_self_loops=True, **kwargs) Bases: :py:obj:`torch_geometric.nn.conv.MessagePassing` The signed graph attentional layers operator from the `"Learning Signed Network Embedding via Graph Attention" `_ paper .. math:: \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) In case :obj:`first_aggr` is :obj:`False`, the layer expects :obj:`x` to be a tensor where :obj:`x[:, :in_dim]` denotes the positive node features :math:`\mathbf{X}^{(\textrm{pos})}` and :obj:`x[:, in_dim:]` denotes the negative node features :math:`\mathbf{X}^{(\textrm{neg})}`. :Parameters: * **in_dim** (*int or tuple*) -- Size of each input sample, or :obj:`-1` to 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 :obj:`False`, the layer will not learn an additive bias. (default: :obj:`True`) * **\*\*kwargs** (*optional*) -- Additional arguments of :class:`torch_geometric.nn.conv.MessagePassing`. .. py:attribute:: in_dim .. py:attribute:: out_dim .. py:attribute:: first_aggr .. py:attribute:: add_self_loops :value: True .. py:attribute:: norm_emb :value: True .. py:attribute:: lin_b .. py:attribute:: lin_u .. py:attribute:: alpha_u .. py:attribute:: alpha_b .. py:method:: reset_parameters() .. py:method:: forward(x: Union[torch.Tensor, torch_geometric.typing.PairTensor], pos_edge_index: torch.LongTensor, neg_edge_index: torch.LongTensor) .. py:method:: message(x1_j: torch.Tensor, x2_j: torch.Tensor, x1_i: torch.Tensor, x2_i: torch.Tensor, edge_p: torch.Tensor, alpha_func, index: torch.Tensor, ptr: torch_geometric.typing.OptTensor, size_i: Optional[int]) -> torch.Tensor