torch_geometric_signed_directed.nn.general.MSConv ================================================= .. py:module:: torch_geometric_signed_directed.nn.general.MSConv Classes ------- .. autoapisummary:: torch_geometric_signed_directed.nn.general.MSConv.MSConv Module Contents --------------- .. py:class:: MSConv(in_channels: int, out_channels: int, K: int, q: float, trainable_q: bool, normalization: str = 'sym', bias: bool = True, cached: bool = False, absolute_degree: bool = True, **kwargs) Bases: :py:obj:`torch_geometric.nn.conv.MessagePassing` Magnetic Signed Laplacian Convolution Layer from the `MSGNN: A Spectral Graph Neural Network Based on a Novel Magnetic Signed Laplacian `_ paper. :Parameters: * **in_channels** (*int*) -- Size of each input sample. * **out_channels** (*int*) -- Size of each output sample. * **K** (*int*) -- Order of the Chebyshev polynomial, i.e., Chebyshev filter size minus 1 :math:`K`. * **q** (*float, optional*) -- Initial value of the phase parameter, 0 <= q <= 0.25. Default: 0.25. * **trainable_q** (*bool, optional*) -- whether to set q to be trainable or not. (default: :obj:`False`) * **normalization** (*str, optional*) -- The normalization scheme for the magnetic Laplacian (default: :obj:`sym`): 1. :obj:`None`: No normalization :math:`\mathbf{L} = \bar{\mathbf{D}} - \mathbf{A} \odot \exp(i \Theta^{(q)})` 2. :obj:`"sym"`: Symmetric normalization :math:`\mathbf{L} = \mathbf{I} - \bar{\mathbf{D}}^{-1/2} \mathbf{A} \bar{\mathbf{D}}^{-1/2} \odot \exp(i \Theta^{(q)})` `\odot` denotes the element-wise multiplication. * **cached** (*bool, optional*) -- If set to :obj:`True`, the layer will cache the __norm__ matrix on first execution, and will use the cached version for further executions. This parameter should only be set to :obj:`True` in transductive learning scenarios. (default: :obj:`False`) * **bias** (*bool, optional*) -- If set to :obj:`False`, the layer will not learn an additive bias. (default: :obj:`True`) * **absolute_degree** (*bool, optional*) -- Whether to calculate the degree matrix with respect to absolute entries of the adjacency matrix. (default: :obj:`True`) * **\*\*kwargs** (*optional*) -- Additional arguments of :class:`torch_geometric.nn.conv.MessagePassing`. .. py:attribute:: in_channels .. py:attribute:: out_channels .. py:attribute:: normalization :value: 'sym' .. py:attribute:: cached :value: False .. py:attribute:: trainable_q .. py:attribute:: absolute_degree :value: True .. py:attribute:: weight .. py:method:: reset_parameters() .. py:method:: forward(x_real: torch.FloatTensor, x_imag: torch.FloatTensor, edge_index: torch.LongTensor, edge_weight: torch_geometric.typing.OptTensor = None, lambda_max: torch_geometric.typing.OptTensor = None) -> torch.FloatTensor Making a forward pass of the Signed Directed Magnetic Laplacian Convolution layer. Arg types: * x_real, x_imag (PyTorch Float Tensor) - Node features. * edge_index (PyTorch Long Tensor) - Edge indices. * edge_weight (PyTorch Float Tensor, optional) - Edge weights corresponding to edge indices. * lambda_max (optional, but mandatory if normalization is None) - Largest eigenvalue of Laplacian. Return types: * out_real, out_imag (PyTorch Float Tensor) - Hidden state tensor for all nodes, with shape (N_nodes, F_out). .. py:method:: message(x_j, norm)