I’m been using dgl/examples/pytorch/recommendation code and input my own data, but it raises that
dgl._ffi.base.DGLError: Expect number of features to match number of edges. Got 17211 and 17271 instead.
So I made a detailed probe into the code and find that the problem is located at GraphIndex.edge_ids, the shape of input tensor and output array did not match. I just know about the code little, but I can feel that there is a bug. And I also add a code to MovieLens.refresh_mask to explain it more succinctly:
tmp = self.g.edges[self.rating_user_vertices, self.rating_movie_vertices].data
from dgl import utils
u, v = tmp._edges
u, v = utils.toindex(u), utils.toindex(v)
u1, v1, e1 = tmp._graph._graph.edge_ids(u, v)
raise Exception("u=%s, u1=%s" % (len(u), len(u1)))
and it turned out to be:
Exception: u=17211, u1=17271