class_docstr: A negative sampler.
class_docstr_tok: ["A","negative","sampler","."]
docstr: Generate negative samples from the positive batch.
  
  :param positive_batch: shape: (batch_size, 3)
      The positive triples.
  
  :return:
      A pair `(negative_batch, filter_mask)` where
  
      1. `negative_batch`: shape: (batch_size, num_negatives, 3)
         The negative batch. ``negative_batch[i, :, :]`` contains the negative examples generated from
         ``positive_batch[i, :]``.
      2. filter_mask: shape: (batch_size, num_negatives)
         An optional filter mask. True where negative samples are valid.
docstr_tok: ["Generate","negative","samples","from","the","positive","batch",".",":","param","positive_batch",":","shape",":","(","batch_size",",","3",")","The","positive","triples",".",":","return",":","A","pair","`","(","negative_batch",",","filter_mask",")","`","where","1",".","`","negative_batch","`",":","shape",":","(","batch_size",",","num_negatives",",","3",")","The","negative","batch",".","``","negative_batch","[","i",",",":",",",":","]","``","contains","the","negative","examples","generated","from","``","positive_batch","[","i",",",":","]","``",".","2.","filter_mask",":","shape",":","(","batch_size",",","num_negatives",")","An","optional","filter","mask",".","True","where","negative","samples","are","valid","."]
code: def sample(
      self, positive_batch: torch.LongTensor
  ) -> Tuple[torch.LongTensor, Optional[torch.BoolTensor]]:
      """
      Generate negative samples from the positive batch.
  
      :param positive_batch: shape: (batch_size, 3)
          The positive triples.
  
      :return:
          A pair `(negative_batch, filter_mask)` where
  
          1. `negative_batch`: shape: (batch_size, num_negatives, 3)
             The negative batch. ``negative_batch[i, :, :]`` contains the negative examples generated from
             ``positive_batch[i, :]``.
          2. filter_mask: shape: (batch_size, num_negatives)
             An optional filter mask. True where negative samples are valid.
      """
      # create unfiltered negative batch by corruption
      negative_batch = self.corrupt_batch(positive_batch=positive_batch)
  
      if self.filterer is None:
          return negative_batch, None
  
      # If filtering is activated, all negative triples that are positive in the training dataset will be removed
      return negative_batch, self.filterer(
          negative_batch=negative_batch
      )
  
file_path: pykeen/src/pykeen/sampling/negative_sampler.py
imports: from abc import abstractmethod
  from typing import Any, ClassVar, Mapping, Optional, Tuple
  import torch
  from class_resolver import HintOrType, normalize_string
  from torch import nn
  from .filtering import Filterer, filterer_resolver
  from ..typing import MappedTriples
label_desc: Use image node_id 3 for calling the NegativeSampler obj's underlying member method code with example usage: obj.sample(positive_batch) and returns: negative_batch,  self, negative_batch,  None