class_docstr: Performs Non-Parametric Instance Discrimination for self supervised learning on
  video. A memory bank is built to keep and update the historical feature embedding
  and use them for contrastive learning.
  
  The original paper is:
  Unsupervised Feature Learning via Non-Parametric Instance Discrimination
  https://arxiv.org/pdf/1805.01978.pdf
  
  More details can be found from the memory bank part in the following paper:
  Momentum Contrast for Unsupervised Visual Representation Learning
  https://arxiv.org/pdf/1911.05722.pdf
class_docstr_tok: ["Performs","Non-Parametric","Instance","Discrimination","for","self","supervised","learning","on","video",".","A","memory","bank","is","built","to","keep","and","update","the","historical","feature","embedding","and","use","them","for","contrastive","learning",".","The","original","paper","is",":","Unsupervised","Feature","Learning","via","Non-Parametric","Instance","Discrimination","https",":","\/\/arxiv.org\/pdf\/1805.01978.pdf","More","details","can","be","found","from","the","memory","bank","part","in","the","following","paper",":","Momentum","Contrast","for","Unsupervised","Visual","Representation","Learning","https",":","\/\/arxiv.org\/pdf\/1911.05722.pdf"]
docstr: Given the memory bank size and the channel dimension, initialize the memory
      bank.
  Args:
      bank_size (int): size of the memory bank, expected to be the same size as
           the training set.
      dim (int): dimension of the channel.
docstr_tok: ["Given","the","memory","bank","size","and","the","channel","dimension",",","initialize","the","memory","bank",".","Args",":","bank_size","(","int",")",":","size","of","the","memory","bank",",","expected","to","be","the","same","size","as","the","training","set",".","dim","(","int",")",":","dimension","of","the","channel","."]
code: def _init_mem_bank(self, bank_size: int, dim: int) -> None:
      """
      Given the memory bank size and the channel dimension, initialize the memory
          bank.
      Args:
          bank_size (int): size of the memory bank, expected to be the same size as
               the training set.
          dim (int): dimension of the channel.
      """
      stdv = 1.0 / math.sqrt(dim / 3)
      self.register_buffer(
          "memory",
          torch.rand(
              bank_size,
              dim,
          )
          .mul_(2 * stdv)
          .add_(-stdv)
          .to(next(self.backbone.parameters()).device),
      )
  
file_path: pytorchvideo/pytorchvideo/models/memory_bank.py
imports: import math
  from typing import Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from pytorchvideo.layers.utils import set_attributes
label_desc: Use image node_id 2 for calling the MemoryBank obj's underlying member method code with example usage: obj._init_mem_bank(bank_size, dim) without return types