class_docstr: Update queue scores, useful with small batches and helps getting
  meaningful gradients.
docstr: If we want to use queue in SwAV training,
  update the queue scores after every forward.
docstr_tok: ["If","we","want","to","use","queue","in","SwAV","training",",","update","the","queue","scores","after","every","forward","."]
code: def on_forward(self, task) -> None:
      """
      If we want to use queue in SwAV training,
      update the queue scores after every forward.
      """
      if not task.config["LOSS"]["name"] == "swav_loss":
          return
      if not task.loss.swav_criterion.use_queue:
          return
      try:
          task.loss.swav_criterion.compute_queue_scores(
              task.model.heads[0]
          )
      except AttributeError:
          task.loss.swav_criterion.compute_queue_scores(
              task.model.module.heads[0]
          )
  
file_path: vissl/vissl/hooks/swav_hooks.py
imports: import contextlib
  import torch
  import torch.nn
  from classy_vision import tasks
  from classy_vision.hooks.classy_hook import ClassyHook
label_desc: Use image node_id 1 for calling the SwAVUpdateQueueScoresHook obj's underlying member method code with example usage: obj.on_forward(task) without return types