Want source node index from DGLBlock

for i, mini_batch in enumerate(dataloader):
    print(mini_batch.blocks[0])
    print(mini_batch.blocks[0].srcnodes._graph)
    print(mini_batch.blocks[0].dstnodes._graph)
    print(i, mini_batch.node_features["id"].shape)
# print
Block(num_src_nodes=1861, num_dst_nodes=1490, num_edges=14845)
Block(num_src_nodes=1861, num_dst_nodes=1490, num_edges=14845)
Block(num_src_nodes=1861, num_dst_nodes=1490, num_edges=14845)
0 torch.Size([1861, 1])

It seems no difference between them.

Both srcnodes._graph and dstnodes._graph refer to the original block. To get source node index, please use block.srcnodes().

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