edge_index: based on the directed graph, we get x1->x0, x2->x0, x3->x0. It should be written like, row: [1, 2, 3] & col: [0, 0, 0] Initializing and calling it is straightforward conv = GCNConv(1, 2) # emb(in), emb(out) x = conv(x, edge_index) Here we let i...
# 需要导入模块: from torch_geometric import nn [as 别名]# 或者: from torch_geometric.nn importGCNConv[as 别名]deftest_asap():in_channels =16edge_index = torch.tensor([[0,0,0,1,1,1,2,2,2,3,3,3], [1,2,3,0,2,3,0,1,3,0,1,2]]) num_nodes = edge_index.max().item()...
(x=batch.x, edge_index=batch.edge_index)) x, edge_index, _, batch, perm, score = self.pool1(x, batch.edge_index, None, batch) x = F.relu(self.conv2(x, edge_index=batch.edge_index)) x = gmp(x, batch) x = x.view(batch_size, -1) x = self.sigmoid(self.fc1(x)) ...
edge_weight = torch.ones((edge_index.size(1),), dtype=x.dtype, device=edge_index.device) # [E+N] edge_index, edge_weight = add_remaining_self_loops(edge_index, edge_weight, 1, x.size(0)) # 2 x (E+N), [E+N] 2.1 Add node's self infomation (value=0) to edge_attr self...