The conflict of forward inputs between HeteroGraphConv and myOwnConv

Hello, I have a problem that the dglnn.HeteroGraphConv.forward only requires two inputs, but myOwnConv.forward requires more inputs, seem like:

self.layers.append(
            dglnn.HeteroGraphConv(
                {
                    etype: myOwnConv(edge_dim, num_etypes, hidden_dim, hidden_dim, 
                                         heads[0], dropout, dropout, negative_slope, 
                                         False, self.activation, alpha=alpha)
                                         for etype in etypes
                }
            )
        )
# The forward of  myOwnConv:  def forward(self, graph, feat, edge_feat, res_attn)

So, when I call:

res_attn = None

for l, (layer, block) in enumerate(zip(self.layers, blocks)):
            h, res_attn = layer(block, h, edge_feat, res_attn=None)

I will got an error TypeError: forward() got an unexpected keyword argument 'res_attn'. How to solve this conflict?

Anyone help?

Hi, you can use the mods_args and mods_kwargs to pass in additional arguments. See the API doc: HeteroGraphConv — DGL 1.1.3 documentation

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.