I encountered an error when converting a hetero graph returned by to_block
to a homo graph using to_homo
. The following code reproduces the error:
hg = dgl.heterograph({
('user', 'follows', 'user'): ([0,1,2], [1,2,3]),
('user', 'buys', 'item'): ([0,1,2], [2,1,0])
})
dst_nodes = {
'user': th.tensor([2]),
'item': th.tensor([1,2])
}
block = dgl.to_block(hg, dst_nodes )
g = dgl.to_homo(block)
Error message:
DGLError: Expect number of features to match number of nodes (len(u)). Got 8 and 10 instead.
Did I use the two APIs incorrectly? Why does to_homo
not work in this case?