class_docstr: The class that can represent a batch of edges.
  
  Parameters
  ----------
  graph : DGLGraph
      Graph object.
  eid : Tensor
      Edge IDs.
  etype : (str, str, str)
      Edge type.
  src_data : dict[str, Tensor]
      Src node features.
  edge_data : dict[str, Tensor]
      Edge features.
  dst_data : dict[str, Tensor]
      Dst node features.
class_docstr_tok: ["The","class","that","can","represent","a","batch","of","edges",".","Parameters","--","--","--","--","--","graph",":","DGLGraph","Graph","object",".","eid",":","Tensor","Edge","IDs",".","etype",":","(","str",",","str",",","str",")","Edge","type",".","src_data",":","dict","[","str",",","Tensor","]","Src","node","features",".","edge_data",":","dict","[","str",",","Tensor","]","Edge","features",".","dst_data",":","dict","[","str",",","Tensor","]","Dst","node","features","."]
docstr: Return the edges in the batch.
  
  Returns
  -------
  (U, V, EID) : (Tensor, Tensor, Tensor)
      The edges in the batch. For each :math:`i`, :math:`(U[i], V[i])` is
      an edge from :math:`U[i]` to :math:`V[i]` with ID :math:`EID[i]`.
  
  Examples
  --------
  The following example uses PyTorch backend.
  
  >>> import dgl
  >>> import torch
  
  >>> # Instantiate a graph.
  >>> g = dgl.graph((torch.tensor([0, 1, 1]), torch.tensor([1, 1, 0])))
  
  >>> # Define a UDF that retrieves and concatenates the end nodes of the
  >>> # edges.
  >>> def edge_udf(edges):
  >>>     src, dst, _ = edges.edges()
  >>>     return {'uv': torch.stack([src, dst], dim=1).float()}
  
  >>> # Create a feature 'uv' with the end nodes of the edges.
  >>> g.apply_edges(edge_udf)
  >>> g.edata['uv']
  tensor([[0., 1.],
          [1., 1.],
          [1., 0.]])
  
  >>> # Use edge UDF in message passing.
  >>> import dgl.function as fn
  >>> g.update_all(edge_udf, fn.sum('uv', 'h'))
  >>> g.ndata['h']
  tensor([[1., 0.],
          [1., 2.]])
docstr_tok: ["Return","the","edges","in","the","batch",".","Returns","--","--","--","-","(","U",",","V",",","EID",")",":","(","Tensor",",","Tensor",",","Tensor",")","The","edges","in","the","batch",".","For","each",":","math",":","`","i","`",",",":","math",":","`","(","U","[","i","]",",","V","[","i","]",")","`","is","an","edge","from",":","math",":","`","U","[","i","]","`","to",":","math",":","`","V","[","i","]","`","with","ID",":","math",":","`","EID","[","i","]","`",".","Examples","--","--","--","--","The","following","example","uses","PyTorch","backend",".",">",">",">","import","dgl",">",">",">","import","torch",">",">",">","#","Instantiate","a","graph",".",">",">",">","g","=","dgl.graph","(","(","torch.tensor","(","[","0",",","1",",","1","]",")",",","torch.tensor","(","[","1",",","1",",","0","]",")",")",")",">",">",">","#","Define","a","UDF","that","retrieves","and","concatenates","the","end","nodes","of","the",">",">",">","#","edges",".",">",">",">","def","edge_udf","(","edges",")",":",">",">",">","src",",","dst",",","_","=","edges.edges","(",")",">",">",">","return","{","'uv","'",":","torch.stack","(","[","src",",","dst","]",",","dim=1",")",".float","(",")","}",">",">",">","#","Create","a","feature","'uv","'","with","the","end","nodes","of","the","edges",".",">",">",">","g.apply_edges","(","edge_udf",")",">",">",">","g.edata","[","'uv","'","]","tensor","(","[","[","0.",",","1",".","]",",","[","1.",",","1",".","]",",","[","1.",",","0",".","]","]",")",">",">",">","#","Use","edge","UDF","in","message","passing",".",">",">",">","import","dgl.function","as","fn",">",">",">","g.update_all","(","edge_udf",",","fn.sum","(","'uv","'",",","'","h","'",")",")",">",">",">","g.ndata","[","'","h","'","]","tensor","(","[","[","1.",",","0",".","]",",","[","1.",",","2",".","]","]",")"]
code: def edges(self):
      """Return the edges in the batch.
  
      Returns
      -------
      (U, V, EID) : (Tensor, Tensor, Tensor)
          The edges in the batch. For each :math:`i`, :math:`(U[i], V[i])` is
          an edge from :math:`U[i]` to :math:`V[i]` with ID :math:`EID[i]`.
  
      Examples
      --------
      The following example uses PyTorch backend.
  
      >>> import dgl
      >>> import torch
  
      >>> # Instantiate a graph.
      >>> g = dgl.graph((torch.tensor([0, 1, 1]), torch.tensor([1, 1, 0])))
  
      >>> # Define a UDF that retrieves and concatenates the end nodes of the
      >>> # edges.
      >>> def edge_udf(edges):
      >>>     src, dst, _ = edges.edges()
      >>>     return {'uv': torch.stack([src, dst], dim=1).float()}
  
      >>> # Create a feature 'uv' with the end nodes of the edges.
      >>> g.apply_edges(edge_udf)
      >>> g.edata['uv']
      tensor([[0., 1.],
              [1., 1.],
              [1., 0.]])
  
      >>> # Use edge UDF in message passing.
      >>> import dgl.function as fn
      >>> g.update_all(edge_udf, fn.sum('uv', 'h'))
      >>> g.ndata['h']
      tensor([[1., 0.],
              [1., 2.]])
      """
      u, v = self._graph.find_edges(
          self._eid, etype=self.canonical_etype
      )
      return u, v, self._eid
  
file_path: dgl/python/dgl/udf.py
imports: from __future__ import absolute_import
label_desc: Use image node_id 5 for calling the EdgeBatch obj's underlying member method code with example usage: obj.edges() and returns: u,  v,  self