from torch_geometric.nn import MessagePassing from torch_geometric.utils import add_self_loops, degree class GCNConv(MessagePassing): def __init__(self, in_channels, out_channels): super(GCNConv, self).__init__(aggr='add') self.lin = torch.nn.Linear(in_channels, out_channels) def forw...
1.2 图表示的基本概念:(1)邻接矩阵(Adjacency matrix)和 (2)度矩阵( Degree matrix) 图一的邻接矩阵和度矩阵 2 GNN的优点 能够处理非欧几里得结构化的数据。CNN和RNN特征提取功能很强,但是只能处理排列整齐的矩阵,图又很难用一个排列整齐矩阵表示。如图二,一张图片很容易就转换成排列整齐的矩阵。但上图图一就很...
degree # 定义GCN空域图卷积神经网络 class GCNConv(MessagePassing, ABC): # 网络初始化 def __init__(self, in_channels, out_channels): """ :param in_channels: 节点属性向量的维度 :param out_channels: 经过图卷积之后,节点的特征表示维度 """ # 定义伽马函数为求和函数,aggr='add' super(GCNConv...