Edge_ids meet error

follow the guide in this page,https://docs.dgl.ai/generated/dgl.DGLGraph.edge_ids.html?highlight=edge_id,
I wrote the following code

to_add_edge_id = dgl_graph_ST.edge_ids(src, dst)

where src and dst are two list

I got the following error message:

File “/opt/conda/envs/dgl_new/lib/python3.7/site-packages/dgl/heterograph.py”, line 2834, in edge_ids
F.as_scalar(F.gather_row(u, idx)),
File “/opt/conda/envs/dgl_new/lib/python3.7/site-packages/dgl/backend/pytorch/tensor.py”, line 43, in as_scalar
return data.item()
ValueError: only one element tensors can be converted to Python scalars

my dgl version is 0.5.2, I searched

Can you provide a code snippet for reproducing the error?

Sorry, I made a mistake,(src, dst) contain the edge that g_ST dosen’t have.
Thanks for help

1 Like