class_docstr: Implementation of the Tico Loss from Tico[0] paper.
  This implementation takes inspiration from the code published
  by sayannag using Lightly. [1]
  
  [0] Jiachen Zhu et. al, 2022, Tico... https://arxiv.org/abs/2206.10698
  [1] https://github.com/sayannag/TiCo-pytorch
  
  Attributes:
  
      Args:
          beta:
              Coefficient for the EMA update of the covariance
              Defaults to 0.9 [0].
          rho:
              Weight for the covariance term of the loss
              Defaults to 8.0 [0].
          gather_distributed:
              If True then the cross-correlation matrices from all gpus are
              gathered and summed before the loss calculation.
  
  Examples:
  
      >>> # initialize loss function
      >>> loss_fn = TiCoLoss()
      >>>
      >>> # generate two random transforms of images
      >>> t0 = transforms(images)
      >>> t1 = transforms(images)
      >>>
      >>> # feed through model
      >>> out0, out1 = model(t0, t1)
      >>>
      >>> # calculate loss
      >>> loss = loss_fn(out0, out1)
class_docstr_tok: ["Implementation","of","the","Tico","Loss","from","Tico","[","0","]","paper",".","This","implementation","takes","inspiration","from","the","code","published","by","sayannag","using","Lightly",".","[","1","]","[","0","]","Jiachen","Zhu","et",".","al",",","2022",",","Tico","...","https",":","\/\/arxiv.org\/abs\/2206.10698","[","1","]","https",":","\/\/github.com\/sayannag\/TiCo-pytorch","Attributes",":","Args",":","beta",":","Coefficient","for","the","EMA","update","of","the","covariance","Defaults","to","0.9","[","0","]",".","rho",":","Weight","for","the","covariance","term","of","the","loss","Defaults","to","8.0","[","0","]",".","gather_distributed",":","If","True","then","the","cross-correlation","matrices","from","all","gpus","are","gathered","and","summed","before","the","loss","calculation",".","Examples",":",">",">",">","#","initialize","loss","function",">",">",">","loss_fn","=","TiCoLoss","(",")",">",">",">",">",">",">","#","generate","two","random","transforms","of","images",">",">",">","t0","=","transforms","(","images",")",">",">",">","t1","=","transforms","(","images",")",">",">",">",">",">",">","#","feed","through","model",">",">",">","out0",",","out1","=","model","(","t0",",","t1",")",">",">",">",">",">",">","#","calculate","loss",">",">",">","loss","=","loss_fn","(","out0",",","out1",")"]
code: def __init__(
      self,
      beta: float = 0.9,
      rho: float = 8.0,
      gather_distributed: bool = False,
  ):
      super(TiCoLoss, self).__init__()
      if gather_distributed and not dist.is_available():
          raise ValueError(
              "gather_distributed is True but torch.distributed is not available. "
              "Please set gather_distributed=False or install a torch version with "
              "distributed support."
          )
  
      self.beta = beta
      self.rho = rho
      self.C = None
      self.gather_distributed = gather_distributed
  
imports: import torch
  import torch.distributed
  from lightly.utils.dist import gather
label_desc: Use image node_id 1 to create a new TiCoLoss object from inherited base classes: torch.nn with example: obj = TiCoLoss(beta, rho, gather_distributed)