code: def invoke_edge_udf(graph, eid, etype, func, *, orig_eid=None):
      """Invoke user-defined edge function on the given edges.
  
      Parameters
      ----------
      graph : DGLGraph
          The input graph.
      eid : Tensor
          The IDs of the edges to invoke UDF on.
      etype : (str, str, str)
          Edge type.
      func : callable
          The user-defined function.
      orig_eid : Tensor, optional
          Original edge IDs. Useful if the input graph is an extracted subgraph.
  
      Returns
      -------
      dict[str, Tensor]
          Results from running the UDF.
      """
      etid = graph.get_etype_id(etype)
      stid, dtid = graph._graph.metagraph.find_edge(etid)
      if is_all(eid):
          u, v, eid = graph.edges(form="all")
          edata = graph._edge_frames[etid]
      else:
          u, v = graph.find_edges(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)
      dstdata = graph._node_frames[dtid].subframe(v)
      ebatch = EdgeBatch(
          graph,
          eid if orig_eid is None else orig_eid,
          etype,
          srcdata,
          edata,
          dstdata,
      )
      return func(ebatch)
  
file_path: dgl/python/dgl/core.py
imports: import numpy
  from .None import backend, function, ops
  from .base import ALL, dgl_warning, DGLError, EID, is_all, NID
  from .frame import Frame
  from .udf import EdgeBatch, NodeBatch
label_desc: Use image node_id 3 for calling a global function with example usage: invoke_edge_udf(graph, eid, etype, func) and returns: func