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 init_memory(self, memory_params):
      self.memory_params = memory_params
      num_items = memory_params.memory_size
      embedding_dim = memory_params.embedding_dim
      self.update_memory_on_forward = (
          memory_params.update_mem_on_forward
      )
      stdv = 1.0 / math.sqrt(embedding_dim / 3)
      self.register_buffer(
          "memory",
          torch.rand(num_items, embedding_dim)
          .mul_(2 * stdv)
          .add_(-stdv),
      )
  
      if memory_params.norm_init:
          self.memory = nn.functional.normalize(self.memory, p=2, dim=1)
      sample_norm = self.memory[:10].norm(dim=1).mean()
      mem_info = f"Init memory: {self.memory.shape}; \
              stdv: {stdv}; normalize: {memory_params.norm_init} \
              norm: {sample_norm}"
      logging.info(f"Rank: {get_rank()} - {mem_info}")
  
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 6 for calling the NCEAverage obj's underlying member method code with example usage: obj.init_memory(memory_params) without return types