class_docstr: Bootstrap Your Own Latent A New Approach to Self-Supervised Learning
  Details can be found in:
  https://arxiv.org/pdf/2006.07733.pdf
docstr: Similarity loss for byol.
  Args:
      q and k (nn.tensor): inputs to calculate the similarity, expected to have
          the same shape of `N x C`.
docstr_tok: ["Similarity","loss","for","byol",".","Args",":","q","and","k","(","nn.tensor",")",":","inputs","to","calculate","the","similarity",",","expected","to","have","the","same","shape","of","`","N","x","C","`","."]
code: def sim_loss(self, q, k):
      """
      Similarity loss for byol.
      Args:
          q and k (nn.tensor): inputs to calculate the similarity, expected to have
              the same shape of `N x C`.
      """
      similarity = torch.einsum("nc,nc->n", [q, k])
      loss = -similarity.mean()
      return loss
  
file_path: pytorchvideo/pytorchvideo/models/byol.py
imports: import copy
  from typing import Callable, Optional
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the BYOL obj's underlying member method code with example usage: obj.sim_loss(q, k) and returns: loss