class_docstr: A negative sampler used to generate negative samples and return
  a mix of positive and negative samples.
  
  Functional name: :obj:`sample_negative`.
  
  Parameters
  ----------
  datapipe : DataPipe
      The datapipe.
  negative_ratio : int
      The proportion of negative samples to positive samples.
docstr: Collates positive and negative samples into minibatch.
  
  Parameters
  ----------
  minibatch : MiniBatch
      The input minibatch, which contains positive node pairs, will be filled
      with negative information in this function.
  neg_pairs : Tuple[Tensor, Tensor]
      A tuple of tensors represents source-destination node pairs of
      negative edges, where negative means the edge may not exist in
      the graph.
  etype : str
      Canonical edge type.
docstr_tok: ["Collates","positive","and","negative","samples","into","minibatch",".","Parameters","--","--","--","--","--","minibatch",":","MiniBatch","The","input","minibatch",",","which","contains","positive","node","pairs",",","will","be","filled","with","negative","information","in","this","function",".","neg_pairs",":","Tuple","[","Tensor",",","Tensor","]","A","tuple","of","tensors","represents","source-destination","node","pairs","of","negative","edges",",","where","negative","means","the","edge","may","not","exist","in","the","graph",".","etype",":","str","Canonical","edge","type","."]
code: def _collate(self, minibatch, neg_pairs, etype=None):
      """Collates positive and negative samples into minibatch.
  
      Parameters
      ----------
      minibatch : MiniBatch
          The input minibatch, which contains positive node pairs, will be filled
          with negative information in this function.
      neg_pairs : Tuple[Tensor, Tensor]
          A tuple of tensors represents source-destination node pairs of
          negative edges, where negative means the edge may not exist in
          the graph.
      etype : str
          Canonical edge type.
      """
      neg_src, neg_dst = neg_pairs
      if neg_src is not None:
          neg_src = neg_src.view(-1, self.negative_ratio)
      if neg_dst is not None:
          neg_dst = neg_dst.view(-1, self.negative_ratio)
      if etype is not None:
          minibatch.negative_srcs[etype] = neg_src
          minibatch.negative_dsts[etype] = neg_dst
      else:
          minibatch.negative_srcs = neg_src
          minibatch.negative_dsts = neg_dst
  
file_path: dgl/python/dgl/graphbolt/negative_sampler.py
imports: from _collections_abc import Mapping
  from torch.utils.data import functional_datapipe
  from .minibatch_transformer import MiniBatchTransformer
label_desc: Use image node_id 4 for calling the NegativeSampler obj's underlying member method code with example usage: obj._collate(minibatch, neg_pairs, etype) without return types