What’s the difference between having a readout of dgl.max_nodes and using MaxPooling? The same question applies to other readout functions and pooling layers. Example network below:
class GCN(nn.Module):
def __init__(self, in_feats, num_classes):
super(GCN, self).__init__()
self.conv1 = GraphConv(in_feats, 64)
self.conv2 = GraphConv(64, 128)
self.conv3 = GraphConv(128, 64)
self.maxpool = MaxPooling()
self.dense = nn.Linear(64, num_classes)
def forward(self, g, in_feat):
h = self.conv1(g, in_feat)
h = F.relu(h)
h = self.conv2(g, h)
h = F.relu(h)
h = self.conv3(g, h)
h = F.relu(h)
g.ndata['h'] = h
hg = dgl.max_nodes(g, 'h')
return self.dense(hg)
Thanks!