class_docstr: Implementation of the Weighted Decoupled Contrastive Learning Loss from
  Decoupled Contrastive Learning [0].
  
  This code implements Equation 6 in [0] with a negative Mises-Fisher
  weighting function. The loss returns the mean over all images `i` and
  views `k` in the mini-batch. The implementation was inspired by [1].
  
  - [0] Chun-Hsiao Y. et. al., 2021, Decoupled Contrastive Learning https://arxiv.org/abs/2110.06848
  - [1] https://github.com/raminnakhli/Decoupled-Contrastive-Learning
  
  Attributes:
      temperature:
          Similarities are scaled by inverse temperature.
      sigma:
          Similar to temperature but applies the inverse scaling in the
          weighting function.
      gather_distributed:
          If True then negatives from all gpus are gathered before the
          loss calculation.
  
  Examples:
  
      >>> loss_fn = DCLWLoss(temperature=0.07)
      >>>
      >>> # generate two random transforms of images
      >>> t0 = transforms(images)
      >>> t1 = transforms(images)
      >>>
      >>> # embed images using some model, for example SimCLR
      >>> out0 = model(t0)
      >>> out1 = model(t1)
      >>>
      >>> # calculate loss
      >>> loss = loss_fn(out0, out1)
code: def __init__(
      self,
      temperature: float = 0.1,
      sigma: float = 0.5,
      gather_distributed: bool = False,
  ):
      super().__init__(
          temperature=temperature,
          weight_fn=partial(negative_mises_fisher_weights, sigma=sigma),
          gather_distributed=gather_distributed,
      )
  
file_path: lightly/lightly/loss/dcl_loss.py
imports: from functools import partial
  from typing import Callable, Optional
  import torch
  from torch import Tensor
  from torch import distributed
  from torch import nn
  from lightly.utils import dist
label_desc: Use image node_id 1 to create a new DCLWLoss object from inherited base classes: DCLLoss with example: obj = DCLWLoss(temperature, sigma, gather_distributed)