class_docstr: Negative sampler that randomly chooses negative source-destination pairs according
  to a uniform distribution.
  
  For each edge ``(u, v)`` of type ``(srctype, etype, dsttype)``, DGL generates at most
  :attr:`k` pairs of negative edges ``(u', v')``, where ``u'`` is chosen uniformly from
  all the nodes of type ``srctype`` and ``v'`` is chosen uniformly from all the nodes
  of type ``dsttype``.  The resulting edges will also have type
  ``(srctype, etype, dsttype)``.  DGL guarantees that the sampled pairs will not have
  edges in between.
  
  Parameters
  ----------
  k : int
      The desired number of negative samples to generate per edge.
  exclude_self_loops : bool, optional
      Whether to exclude self-loops from negative samples.  (Default: True)
  replace : bool, optional
      Whether to sample with replacement.  Setting it to True will make things
      faster.  (Default: False)
  
  Notes
  -----
  This negative sampler will try to generate as many negative samples as possible, but
  it may rarely return less than :attr:`k` negative samples per edge.
  This is more likely to happen if a graph is so small or dense that not many unique
  negative samples exist.
  
  Examples
  --------
  >>> g = dgl.graph(([0, 1, 2], [1, 2, 3]))
  >>> neg_sampler = dgl.dataloading.negative_sampler.GlobalUniform(2, True)
  >>> neg_sampler(g, torch.LongTensor([0, 1]))
  (tensor([0, 1, 3, 2]), tensor([2, 0, 2, 1]))
code: def __init__(self, k, exclude_self_loops=True, replace=False):
      self.k = k
      self.exclude_self_loops = exclude_self_loops
      self.replace = replace
  
file_path: dgl/python/dgl/dataloading/negative_sampler.py
imports: from collections.abc import Mapping
  from ..None import backend
label_desc: Use image node_id 1 to create a new GlobalUniform object from inherited base classes: _BaseNegativeSampler with example: obj = GlobalUniform(k, exclude__loops, replace)