-
Hi Matt, class Net(torch.nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = SplineConv(d.num_features, 32, dim=2, kernel_size=5)
self.conv2 = SplineConv(32, 64, dim=2, kernel_size=5)
self.fc1 = torch.nn.Linear(64, 128)
self.fc2 = torch.nn.Linear(128, d.num_classes)
def forward(self, data):
data.x = self.conv1(data.x, data.edge_index, data.edge_attr)
weight = normalized_cut_2d(data.edge_index, data.pos)
cluster = graclus(data.edge_index, weight, data.x.size(0))
data = max_pool(cluster, data, transform=transform)
data.x = self.conv2(data.x, data.edge_index, data.edge_attr)
weight = normalized_cut_2d(data.edge_index, data.pos)
cluster = graclus(data.edge_index, weight, data.x.size(0))
x, batch = max_pool_x(cluster, data.x, data.batch)
x = global_mean_pool(x, batch)
x = F.elu(self.fc1(x))
x = F.dropout(x, training=self.training)
return F.log_softmax(self.fc2(x), dim=1) In this example, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is actually true for any GNN implemented in PyG. Every GNN will output new node features |
Beta Was this translation helpful? Give feedback.
This is actually true for any GNN implemented in PyG. Every GNN will output new node features
x
, but not all can handle edge features as input. The cheatsheet should give you clarification on whether a GNN supports handling of edge features. Let me know if this is helpful to you.