torch_geometric.nn.conv.GMMConv
- class GMMConv(in_channels: Union[int, Tuple[int, int]], out_channels: int, dim: int, kernel_size: int, separate_gaussians: bool = False, aggr: str = 'mean', root_weight: bool = True, bias: bool = True, **kwargs)[source]
Bases:
MessagePassing来自“使用混合模型CNN在图和流形上进行几何深度学习”论文的高斯混合模型卷积算子。
\[\mathbf{x}^{\prime}_i = \frac{1}{|\mathcal{N}(i)|} \sum_{j \in \mathcal{N}(i)} \frac{1}{K} \sum_{k=1}^K \mathbf{w}_k(\mathbf{e}_{i,j}) \odot \mathbf{\Theta}_k \mathbf{x}_j,\]其中
\[\mathbf{w}_k(\mathbf{e}) = \exp \left( -\frac{1}{2} {\left( \mathbf{e} - \mathbf{\mu}_k \right)}^{\top} \Sigma_k^{-1} \left( \mathbf{e} - \mathbf{\mu}_k \right) \right)\]表示基于可训练均值向量 \(\mathbf{\mu}_k\) 和对角协方差矩阵 \(\mathbf{\Sigma}_k\) 的加权函数。
注意
边缘属性 \(\mathbf{e}_{ij}\) 通常由 \(\mathbf{e}_{ij} = \mathbf{p}_j - \mathbf{p}_i\) 给出,其中 \(\mathbf{p}_i\) 表示节点 \(i\) 的位置(参见
torch_geometric.transform.Cartesian)。- Parameters:
in_channels (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_channels (int) – Size of each output sample.
dim (int) – Pseudo-coordinate dimensionality.
kernel_size (int) – 核的数量 \(K\)。
separate_gaussians (bool, 可选) – 如果设置为
True,将为每对输入和输出通道学习单独的GMM,灵感来自传统的CNN。(默认值:False)aggr (str, 可选) – 使用的聚合运算符 (
"add","mean","max"). (默认:"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.
- Shapes:
input: node features \((|\mathcal{V}|, F_{in})\) or \(((|\mathcal{V_s}|, F_{s}), (|\mathcal{V_t}|, F_{t}))\) if bipartite, edge indices \((2, |\mathcal{E}|)\), edge features \((|\mathcal{E}|, D)\) (optional)
output: node features \((|\mathcal{V}|, F_{out})\) or \((|\mathcal{V}_t|, F_{out})\) if bipartite