I am applying GroupReveRes on this below mentioned model. But, it give me error every time.
Error is
"
RuntimeError: The size of tensor a must match the size of tensor b at non-singleton dimension 1"
class GNNLayer(nn.Module):
def init(self, feats, dropout=0.2):
super(GNNLayer, self).init()
# Use BatchNorm and dropout to prevent gradient vanishing
# In particular if you use a large number of GNN layers
self.norm = nn.BatchNorm1d(feats)
self.conv1 = GraphConv(feats, feats)
self.conv2 = GraphConv(feat, 30)
self.dropout = nn.Dropout(dropout)
def forward(self, g, x):
x = self.norm(x)
x = self.dropout(x)
x1 = self.conv1(g,x)
x2= self.conv2(g,x1)
return x2
num_nodes = 5
num_edges = 20
feats = 32
groups = 2
g = dgl.rand_graph(num_nodes, num_edges)
x = torch.randn(num_nodes, feats)
conv = GNNLayer(feats // groups)
model = GroupRevRes(conv, groups)
out = model(g, x)
I have followed this whole code from dgl example “GroupRevRes — DGL 1.1 documentation”
Does anyone tell me, how can I apply GraphRevRes on the above mentioned model? Secondly, how I can select this group attribute? Here in above example, 2 value is chosen for group.