class_docstr: Kozachenko-Leonenko entropic loss regularizer from Sablayrolles et al. - 2018 - Spreading vectors for similarity search
docstr: Args:
      student_output (BxD): backbone output of student
docstr_tok: ["Args",":","student_output","(","BxD",")",":","backbone","output","of","student"]
code: def forward(self, student_output, eps=1e-8):
      """
      Args:
          student_output (BxD): backbone output of student
      """
      with torch.cuda.amp.autocast(enabled=False):
          student_output = F.normalize(
              student_output, eps=eps, p=2, dim=-1
          )
          I = self.pairwise_NNs_inner(student_output)  # noqa: E741
          distances = self.pdist(
              student_output, student_output[I]
          )  # BxD, BxD -> B
          loss = -torch.log(distances + eps).mean()
      return loss
  
file_path: dinov2/dinov2/loss/koleo_loss.py
imports: import logging
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the KoLeoLoss obj's underlying member method code with example usage: obj.forward(student_output, eps) and returns: loss