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 number of edges in the batch.
  
  Returns
  -------
  int
  
  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 returns one for each edge.
  >>> def edge_udf(edges):
  >>>     return {'h': torch.ones(edges.batch_size(), 1)}
  
  >>> # Creates a feature 'h'.
  >>> g.apply_edges(edge_udf)
  >>> g.edata['h']
  tensor([[1.],
          [1.],
          [1.]])
  
  >>> # Use edge UDF in message passing.
  >>> import dgl.function as fn
  >>> g.update_all(edge_udf, fn.sum('h', 'h'))
  >>> g.ndata['h']
  tensor([[1.],
          [2.]])
docstr_tok: ["Return","the","number","of","edges","in","the","batch",".","Returns","--","--","--","-","int","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","returns","one","for","each","edge",".",">",">",">","def","edge_udf","(","edges",")",":",">",">",">","return","{","'","h","'",":","torch.ones","(","edges.batch_size","(",")",",","1",")","}",">",">",">","#","Creates","a","feature","'","h","'",".",">",">",">","g.apply_edges","(","edge_udf",")",">",">",">","g.edata","[","'","h","'","]","tensor","(","[","[","1",".","]",",","[","1",".","]",",","[","1",".","]","]",")",">",">",">","#","Use","edge","UDF","in","message","passing",".",">",">",">","import","dgl.function","as","fn",">",">",">","g.update_all","(","edge_udf",",","fn.sum","(","'","h","'",",","'","h","'",")",")",">",">",">","g.ndata","[","'","h","'","]","tensor","(","[","[","1",".","]",",","[","2",".","]","]",")"]
code: def batch_size(self):
      """Return the number of edges in the batch.
  
      Returns
      -------
      int
  
      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 returns one for each edge.
      >>> def edge_udf(edges):
      >>>     return {'h': torch.ones(edges.batch_size(), 1)}
  
      >>> # Creates a feature 'h'.
      >>> g.apply_edges(edge_udf)
      >>> g.edata['h']
      tensor([[1.],
              [1.],
              [1.]])
  
      >>> # Use edge UDF in message passing.
      >>> import dgl.function as fn
      >>> g.update_all(edge_udf, fn.sum('h', 'h'))
      >>> g.ndata['h']
      tensor([[1.],
              [2.]])
      """
      return len(self._eid)
  
file_path: dgl/python/dgl/udf.py
imports: from __future__ import absolute_import
label_desc: Use image node_id 6 for calling the EdgeBatch obj's underlying member method code with example usage: obj.batch_size() and returns: len