class_docstr: Computes the scores of the model embeddings against the `positive'
  and `negative' samples from the Memory Bank.
  This class does *NOT* compute the actual loss, just the scores,
  i.e., inner products followed by normalizations/exponentiation etc.
class_docstr_tok: ["Computes","the","scores","of","the","model","embeddings","against","the","`","positive'","and","`","negative","'","samples","from","the","Memory","Bank",".","This","class","does","*","NOT","*","compute","the","actual","loss",",","just","the","scores",",","i.e.",",","inner","products","followed","by","normalizations\/exponentiation","etc","."]
code: def setup_negative_sampling(self, negative_sampling_params):
      self.negative_sampling_params = negative_sampling_params
      assert self.negative_sampling_params["type"] in [
          "random",
          "debug",
      ]
      self.negative_sampling_params = negative_sampling_params
      if self.negative_sampling_params.type == "debug":
          logging.info("Using debug mode for negative sampling.")
          logging.info("Will use slower NumpySampler.")
          self.multinomial = NumpySampler(self.nLem)
      else:
          unigrams = torch.ones(self.nLem)
          self.multinomial = AliasMethod(unigrams)
      self.num_negatives = negative_sampling_params["num_negatives"]
  
imports: import logging
  import math
  import pprint
  from typing import List, Union
  import numpy
  import torch
  from classy_vision.generic.distributed_util import all_reduce_mean, gather_from_all, get_rank
  from classy_vision.generic.util import is_pos_int
  from classy_vision.losses import ClassyLoss, register_loss
  from torch import nn
  from vissl.config import AttrDict
label_desc: Use image node_id 5 for calling the NCEAverage obj's underlying member method code with example usage: obj.setup_negative_sampling(negative_sampling_params) without return types