torch_geometric_signed_directed.nn.signed.SGCNConv ================================================== .. py:module:: torch_geometric_signed_directed.nn.signed.SGCNConv Classes ------- .. autoapisummary:: torch_geometric_signed_directed.nn.signed.SGCNConv.SGCNConv Module Contents --------------- .. py:class:: SGCNConv(in_dim: int, out_dim: int, first_aggr: bool, bias: bool = True, norm_emb: bool = False, **kwargs) Bases: :py:obj:`torch_geometric.nn.conv.MessagePassing` The signed graph convolutional operator from the `"Signed Graph Convolutional Network" `_ paper .. math:: \mathbf{x}_v^{(\textrm{pos})} &= \mathbf{\Theta}^{(\textrm{pos})} \left[ \frac{1}{|\mathcal{N}^{+}(v)|} \sum_{w \in \mathcal{N}^{+}(v)} \mathbf{x}_w , \mathbf{x}_v \right] \mathbf{x}_v^{(\textrm{neg})} &= \mathbf{\Theta}^{(\textrm{neg})} \left[ \frac{1}{|\mathcal{N}^{-}(v)|} \sum_{w \in \mathcal{N}^{-}(v)} \mathbf{x}_w , \mathbf{x}_v \right] if :obj:`first_aggr` is set to :obj:`True`, and .. math:: \mathbf{x}_v^{(\textrm{pos})} &= \mathbf{\Theta}^{(\textrm{pos})} \left[ \frac{1}{|\mathcal{N}^{+}(v)|} \sum_{w \in \mathcal{N}^{+}(v)} \mathbf{x}_w^{(\textrm{pos})}, \frac{1}{|\mathcal{N}^{-}(v)|} \sum_{w \in \mathcal{N}^{-}(v)} \mathbf{x}_w^{(\textrm{neg})}, \mathbf{x}_v^{(\textrm{pos})} \right] \mathbf{x}_v^{(\textrm{neg})} &= \mathbf{\Theta}^{(\textrm{pos})} \left[ \frac{1}{|\mathcal{N}^{+}(v)|} \sum_{w \in \mathcal{N}^{+}(v)} \mathbf{x}_w^{(\textrm{neg})}, \frac{1}{|\mathcal{N}^{-}(v)|} \sum_{w \in \mathcal{N}^{-}(v)} \mathbf{x}_w^{(\textrm{pos})}, \mathbf{x}_v^{(\textrm{neg})} \right] otherwise. 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. * **norm_emb** (*bool, optional*) -- Whether to normalize embeddings. (default: :obj:`False`) * **bias** (*bool, optional*) -- If set to :obj:`False`, the layer will not learn an additive bias. (default: :obj:`True`) * **norm_emb** (*bool*) -- Denotes embedding is normalized or not. (default: :obj:`False`) * **\*\*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:: norm_emb :value: False .. py:method:: reset_parameters() .. py:method:: forward(x: Union[torch.Tensor, torch_geometric.typing.PairTensor], pos_edge_index: torch_geometric.typing.Adj, neg_edge_index: torch_geometric.typing.Adj) -> torch.Tensor .. py:method:: message(x_j: torch.Tensor) -> torch.Tensor .. py:method:: message_and_aggregate(adj_t: torch_geometric.typing.SparseTensor, x: torch_geometric.typing.PairTensor) -> torch.Tensor