code: def invoke_node_udf(
      graph, nid, ntype, func, *, ndata=None, orig_nid=None
  ):
      """Invoke user-defined node function on the given nodes.
  
      Parameters
      ----------
      graph : DGLGraph
          The input graph.
      nid : Tensor
          The IDs of the nodes to invoke UDF on.
      ntype : str
          Node type.
      func : callable
          The user-defined function.
      ndata : dict[str, Tensor], optional
          If provided, apply the UDF on this ndata instead of the ndata of the graph.
      orig_nid : Tensor, optional
          Original node IDs. Useful if the input graph is an extracted subgraph.
  
      Returns
      -------
      dict[str, Tensor]
          Results from running the UDF.
      """
      ntid = graph.get_ntype_id(ntype)
      if ndata is None:
          if is_all(nid):
              ndata = graph._node_frames[ntid]
              nid = graph.nodes(ntype=ntype)
          else:
              ndata = graph._node_frames[ntid].subframe(nid)
      nbatch = NodeBatch(
          graph, nid if orig_nid is None else orig_nid, ntype, ndata
      )
      return func(nbatch)
  
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 2 for calling a global function with example usage: invoke_node_udf(graph, nid, ntype, func) and returns: func