Unverified Commit 16e324da authored by xiang song(charlie.song)'s avatar xiang song(charlie.song) Committed by GitHub
Browse files

[Bug Fix] Add warning for invalid input graph of edge UDF (#2682)



* Add warning for invalid graph of edge UDF

* lint
Co-authored-by: default avatarUbuntu <ubuntu@ip-172-31-56-220.ec2.internal>
parent 72a16b22
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# pylint: disable=not-callable # pylint: disable=not-callable
import numpy as np import numpy as np
from .base import DGLError, is_all, NID, EID, ALL from .base import DGLError, is_all, NID, EID, ALL, dgl_warning
from . import backend as F from . import backend as F
from . import function as fn from . import function as fn
from .frame import Frame from .frame import Frame
...@@ -75,6 +75,9 @@ def invoke_edge_udf(graph, eid, etype, func, *, orig_eid=None): ...@@ -75,6 +75,9 @@ def invoke_edge_udf(graph, eid, etype, func, *, orig_eid=None):
else: else:
u, v = graph.find_edges(eid) u, v = graph.find_edges(eid)
edata = graph._edge_frames[etid].subframe(eid) edata = graph._edge_frames[etid].subframe(eid)
if len(u) == 0:
dgl_warning('The input graph for the user-defined edge function ' \
'does not contain valid edges')
srcdata = graph._node_frames[stid].subframe(u) srcdata = graph._node_frames[stid].subframe(u)
dstdata = graph._node_frames[dtid].subframe(v) dstdata = graph._node_frames[dtid].subframe(v)
ebatch = EdgeBatch(graph, eid if orig_eid is None else orig_eid, ebatch = EdgeBatch(graph, eid if orig_eid is None else orig_eid,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment