Errors occurred when R-GCN was implemented in DGL

In the code that defines rgcn hidden layer in the tutorial:
if self.is_input_layer:
def message_func(edges):
# for input layer, matrix multiply can be converted to be
# an embedding lookup using source node id
embed = weight.view(-1, self.out_feat)
index =[‘rel_type’] * self.in_feat + edges.src[‘id’]

            return {'msg': embed[index] *['norm']}

Error occurred:
index =[‘rel_type’] * self.in_feat + edges.src[‘id’]
RuntimeError: expected backend CPU and dtype Long but got backend CPU and dtype Int

How to modify it?

Convert index to dtype Long should solve the problem:

index = ([‘rel_type’] * self.in_feat + edges.src[‘id’]).long()
1 Like

Is this a bug that should be fixed?

thank you,I convert index to dtype Long:
index =[‘rel_type’].long() * self.in_feat + edges.src[‘id’]
and problem has solved.

yes,and I have solved this bug