torch_geometric.nn.aggr.DeepSetsAggregation
- class DeepSetsAggregation(local_nn: Optional[Module] = None, global_nn: Optional[Module] = None)[source]
Bases:
Aggregation执行深度集合聚合,其中要聚合的元素首先通过多层感知机(MLP)\(\phi_{\mathbf{\Theta}}\)进行转换,求和,然后通过另一个MLP \(\rho_{\mathbf{\Theta}}\)进行转换,如“具有自适应读数的图神经网络”论文中所建议的。
- Parameters:
local_nn (torch.nn.Module, optional) – 神经网络 \(\phi_{\mathbf{\Theta}}\), 例如, 由
torch.nn.Sequential或torch_geometric.nn.models.MLP定义. (默认:None)global_nn (torch.nn.Module, optional) – 神经网络 \(\rho_{\mathbf{\Theta}}\), 例如, 由
torch.nn.Sequential或torch_geometric.nn.models.MLP定义. (默认:None)
- forward(x: Tensor, index: Optional[Tensor] = None, ptr: Optional[Tensor] = None, dim_size: Optional[int] = None, dim: int = -2) Tensor[source]
前向传播。
- Parameters:
x (torch.Tensor) – The source tensor.
index (torch.Tensor, optional) – The indices of elements for applying the aggregation. One of
indexorptrmust be defined. (default:None)ptr (torch.Tensor, optional) – If given, computes the aggregation based on sorted inputs in CSR representation. One of
indexorptrmust be defined. (default:None)dim_size (int, optional) – The size of the output tensor at dimension
dimafter aggregation. (default:None)dim (int, optional) – The dimension in which to aggregate. (default:
-2)max_num_elements – (int, optional): The maximum number of elements within a single aggregation group. (default:
None)
- Return type: