torch_geometric.nn.conv.SplineConv

class SplineConv(in_channels: Union[int, Tuple[int, int]], out_channels: int, dim: int, kernel_size: Union[int, List[int]], is_open_spline: bool = True, degree: int = 1, aggr: str = 'mean', root_weight: bool = True, bias: bool = True, **kwargs)[source]

Bases: MessagePassing

基于样条的卷积算子来自“SplineCNN: Fast Geometric Deep Learning with Continuous B-Spline Kernels”论文。

\[\mathbf{x}^{\prime}_i = \frac{1}{|\mathcal{N}(i)|} \sum_{j \in \mathcal{N}(i)} \mathbf{x}_j \cdot h_{\mathbf{\Theta}}(\mathbf{e}_{i,j}),\]

其中 \(h_{\mathbf{\Theta}}\) 表示定义在加权B样条张量积基上的核函数。

注意

伪坐标必须位于固定区间 \([0, 1]\) 内,以便此方法按预期工作。

Parameters:
  • in_channels (int or tuple) – Size of each input sample, or -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_channels (int) – Size of each output sample.

  • dim (int) – 伪坐标维度。

  • kernel_size (int[int]) – 卷积核的大小。

  • is_open_spline (bool[bool], 可选) – 如果设置为 False,操作符将在此维度中使用闭合的B样条基。 (默认 True)

  • degree (int, optional) – B样条基函数的度数。(默认值:1

  • aggr (str, optional) – The aggregation scheme to use ("add", "mean", "max"). (default: "mean")

  • root_weight (bool, optional) – If set to False, the layer will not add transformed root node features to the output. (default: True)

  • 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.

forward(x: Union[Tensor, Tuple[Tensor, Optional[Tensor]]], edge_index: Union[Tensor, SparseTensor], edge_attr: Optional[Tensor] = None, size: Optional[Tuple[int, int]] = None) Tensor[source]

运行模块的前向传播。

Return type:

Tensor

reset_parameters()[source]

重置模块的所有可学习参数。