class_docstr: Implementation of the SwaV loss.
  
  Attributes:
      temperature:
          Temperature parameter used for cross entropy calculations.
      sinkhorn_iterations:
          Number of iterations of the sinkhorn algorithm.
      sinkhorn_epsilon:
          Temperature parameter used in the sinkhorn algorithm.
      sinkhorn_gather_distributed:
          If True then features from all gpus are gathered to calculate the
          soft codes in the sinkhorn algorithm.
docstr: Calculates the cross entropy for the SwaV prediction problem.
  
  Args:
      z:
          Similarity of the features and the SwaV prototypes.
      q:
          Codes obtained from Sinkhorn iterations.
  
  Returns:
      Cross entropy between predictions z and codes q.
docstr_tok: ["Calculates","the","cross","entropy","for","the","SwaV","prediction","problem",".","Args",":","z",":","Similarity","of","the","features","and","the","SwaV","prototypes",".","q",":","Codes","obtained","from","Sinkhorn","iterations",".","Returns",":","Cross","entropy","between","predictions","z","and","codes","q","."]
code: def subloss(self, z: torch.Tensor, q: torch.Tensor):
      """Calculates the cross entropy for the SwaV prediction problem.
  
      Args:
          z:
              Similarity of the features and the SwaV prototypes.
          q:
              Codes obtained from Sinkhorn iterations.
  
      Returns:
          Cross entropy between predictions z and codes q.
  
      """
      return -torch.mean(
          torch.sum(
              q * F.log_softmax(z / self.temperature, dim=1), dim=1
          )
      )
  
file_path: lightly/lightly/loss/swav_loss.py
imports: from typing import List
  import torch
  import torch.distributed
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the SwaVLoss obj's underlying member method code with example usage: obj.subloss(z, q) and returns: unknown