torch_geometric.nn.conv.CuGraphRGCNConv

class CuGraphRGCNConv(in_channels: int, out_channels: int, num_relations: int, num_bases: Optional[int] = None, aggr: str = 'mean', root_weight: bool = True, bias: bool = True)[source]

Bases: CuGraphModule

The relational graph convolutional operator from the “Modeling Relational Data with Graph Convolutional Networks” paper.

CuGraphRGCNConvRGCNConv 的优化版本,基于 cugraph-ops 包,融合了消息传递计算以加速执行并减少内存占用。

forward(x: Tensor, edge_index: EdgeIndex, edge_type: Tensor, max_num_neighbors: Optional[int] = None) Tensor[source]

运行模块的前向传播。

Parameters:
  • x (torch.Tensor) – The node features.

  • edge_index (EdgeIndex) – The edge indices.

  • edge_type (torch.Tensor) – 边的类型。

  • max_num_neighbors (int, 可选) – 目标节点的最大邻居数。仅在二分图中操作时有效。如果未提供,该值将在运行时计算,导致性能略有下降。 (默认值: None)

Return type:

Tensor

reset_parameters()[source]

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