How to pass in edge weights in HeteroGraphConv

GraphConv’s forward function can pass in edge weights, but HeteroGraphConv’s forward function cannot pass in edge weights. How should I pass the weight to each dglnn.GraphConv?
class RGCN(nn.Module):
def init(self, lnc_in_feats, lnc_hid_feats, mi_in_feats, mi_hid_feats):
self.conv1 = dglnn.HeteroGraphConv({
}, aggregate=‘stack’)

def forward(self, graph, inputs, edge_weight=edge_weight):
    h = self.conv1(graph, inputs)

There’s a mod_kwargs argument you can feed in. It takes in a dictionary of edge types and the keyword arguments each corresponding NN module will receive.

Thank you for your reply, BarclayII !
But I did not find an example of the use of mod_kwargs.
I have tried several input methods but none of them are correct.
Can you tell me what should be done in this example?

You could try

x = self.conv1(graph, input_dict, mod_kwargs={
    'edge_type1': {'edge_weight': edge_weight1},
    'edge_type2': {'edge_weight': edge_weight2},

Thank you for your reply, BarclayII !
You solved my difficulties.
Hope dgl is getting better and better.

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