class_docstr: This is the loss which was proposed in the "Momentum Contrast
  for Unsupervised Visual Representation Learning" paper, from Kaiming He et al.
  See http://arxiv.org/abs/1911.05722 for details
  and https://github.com/facebookresearch/moco for a reference implementation, reused here
  
  Config params:
      embedding_dim (int): head output output dimension
      queue_size (int): number of elements in queue
      momentum (float): encoder momentum value for the update
      temperature (float): temperature to use on the logits
class_docstr_tok: ["This","is","the","loss","which","was","proposed","in","the","``","Momentum","Contrast","for","Unsupervised","Visual","Representation","Learning","''","paper",",","from","Kaiming","He","et","al",".","See","http",":","\/\/arxiv.org\/abs\/1911.05722","for","details","and","https",":","\/\/github.com\/facebookresearch\/moco","for","a","reference","implementation",",","reused","here","Config","params",":","embedding_dim","(","int",")",":","head","output","output","dimension","queue_size","(","int",")",":","number","of","elements","in","queue","momentum","(","float",")",":","encoder","momentum","value","for","the","update","temperature","(","float",")",":","temperature","to","use","on","the","logits"]
code: def __init__(self, config: MoCoLossConfig):
      super().__init__()
      self.loss_config = config
  
      # Create the queue
      self.register_buffer(
          "queue",
          torch.randn(
              self.loss_config.embedding_dim,
              self.loss_config.queue_size,
          ),
      )
      self.queue = nn.functional.normalize(self.queue, dim=0)
  
      self.register_buffer(
          "queue_ptr", torch.zeros(1, dtype=torch.long)
      )
      self.criterion = nn.CrossEntropyLoss()
      self.initialized = False
  
      self.key = None
      self.sample = None
      self.moco_encoder = None
  
      self.checkpoint = None
  
file_path: vissl/vissl/losses/moco_loss.py
imports: import logging
  import pprint
  from collections import namedtuple
  import torch
  from classy_vision.losses import ClassyLoss, register_loss
  from torch import nn
  from vissl.utils.misc import concat_all_gather
label_desc: Use image node_id 1 to create a new MoCoLoss object from inherited base classes: ClassyLoss with example: obj = MoCoLoss(config)