class_docstr: This hook is for the extension of the SwAV loss proposed in paper
  https://arxiv.org/abs/2006.09882 by Caron et al. The loss combines
  the benefits of using the SwAV approach with the momentum encoder
  as used in MoCo.
class_docstr_tok: ["This","hook","is","for","the","extension","of","the","SwAV","loss","proposed","in","paper","https",":","\/\/arxiv.org\/abs\/2006.09882","by","Caron","et","al",".","The","loss","combines","the","benefits","of","using","the","SwAV","approach","with","the","momentum","encoder","as","used","in","MoCo","."]
docstr: Args:
      momentum (float): for the momentum encoder
      momentum_eval_mode_iter_start (int): from what iteration should the
                      momentum encoder network be in eval mode
      crops_for_assign (List[int]): what crops to use for assignment
docstr_tok: ["Args",":","momentum","(","float",")",":","for","the","momentum","encoder","momentum_eval_mode_iter_start","(","int",")",":","from","what","iteration","should","the","momentum","encoder","network","be","in","eval","mode","crops_for_assign","(","List","[","int","]",")",":","what","crops","to","use","for","assignment"]
code: def __init__(
      self,
      momentum: float,
      momentum_eval_mode_iter_start: int,
      crops_for_assign: List[int],
  ):
      """
      Args:
          momentum (float): for the momentum encoder
          momentum_eval_mode_iter_start (int): from what iteration should the
                          momentum encoder network be in eval mode
          crops_for_assign (List[int]): what crops to use for assignment
      """
  
      super().__init__()
      self.momentum = momentum
      self.inv_momentum = 1.0 - momentum
      self.crops_for_assign = crops_for_assign
      self.is_distributed = False
      self.momentum_eval_mode_iter_start = momentum_eval_mode_iter_start
  
file_path: vissl/vissl/hooks/swav_momentum_hooks.py
imports: import logging
  from typing import List
  import torch
  from classy_vision import tasks
  from classy_vision.generic.distributed_util import init_distributed_data_parallel_model
  from classy_vision.hooks.classy_hook import ClassyHook
  from torch import nn
  from vissl.models import build_model
  from vissl.utils.env import get_machine_local_and_dist_rank
label_desc: Use image node_id 1 to create a new SwAVMomentumHook object from inherited base classes: ClassyHook with example: obj = SwAVMomentumHook(momentum, momentum_eval_mode_iter_start, crops_for_assign)