docstr: time-frequency Deep Clustering loss.
  
  References:
      [1] Deep clustering: Discriminative embeddings for segmentation and
          separation; John R. Hershey. et al., 2016;
          https://ieeexplore.ieee.org/document/7471631
      [2] Manifold-Aware Deep Clustering: Maximizing Angles Between Embedding
          Vectors Based on Regular Simplex; Tanaka, K. et al., 2021;
          https://www.isca-speech.org/archive/interspeech_2021/tanaka21_interspeech.html
  
  Args:
      ref: List[(Batch, T, F) * spks]
      inf: (Batch, T*F, D)
  Returns:
      loss: (Batch,)
docstr_tok: ["time-frequency","Deep","Clustering","loss",".","References",":","[","1","]","Deep","clustering",":","Discriminative","embeddings","for","segmentation","and","separation",";","John","R.","Hershey",".","et","al.",",","2016",";","https",":","\/\/ieeexplore.ieee.org\/document\/7471631","[","2","]","Manifold-Aware","Deep","Clustering",":","Maximizing","Angles","Between","Embedding","Vectors","Based","on","Regular","Simplex",";","Tanaka",",","K.","et","al.",",","2021",";","https",":","\/\/www.isca-speech.org\/archive\/interspeech_2021\/tanaka21_interspeech.html","Args",":","ref",":","List","[","(","Batch",",","T",",","F",")","*","spks","]","inf",":","(","Batch",",","T","*","F",",","D",")","Returns",":","loss",":","(","Batch",",",")"]
code: def forward(self, ref, inf) -> torch.Tensor:
      """time-frequency Deep Clustering loss.
  
      References:
          [1] Deep clustering: Discriminative embeddings for segmentation and
              separation; John R. Hershey. et al., 2016;
              https://ieeexplore.ieee.org/document/7471631
          [2] Manifold-Aware Deep Clustering: Maximizing Angles Between Embedding
              Vectors Based on Regular Simplex; Tanaka, K. et al., 2021;
              https://www.isca-speech.org/archive/interspeech_2021/tanaka21_interspeech.html
  
      Args:
          ref: List[(Batch, T, F) * spks]
          inf: (Batch, T*F, D)
      Returns:
          loss: (Batch,)
      """  # noqa: E501
      assert len(ref) > 0
      num_spk = len(ref)
  
      # Compute the ref for Deep Clustering[1][2]
      abs_ref = [abs(n) for n in ref]
      if self._loss_type == "dpcl":
          r = torch.zeros_like(abs_ref[0])
          B = ref[0].shape[0]
          for i in range(num_spk):
              flags = [abs_ref[i] >= n for n in abs_ref]
              mask = reduce(lambda x, y: x * y, flags)
              mask = mask.int() * i
              r += mask
          r = r.contiguous().flatten().long()
          re = F.one_hot(r, num_classes=num_spk)
          re = re.contiguous().view(B, -1, num_spk)
      elif self._loss_type == "mdc":
          B = ref[0].shape[0]
          manifold_vector = torch.full(
              (num_spk, num_spk),
              (-1 / num_spk) * math.sqrt(num_spk / (num_spk - 1)),
              dtype=inf.dtype,
              device=inf.device,
          )
          for i in range(num_spk):
              manifold_vector[i][i] = (
                  (num_spk - 1) / num_spk
              ) * math.sqrt(num_spk / (num_spk - 1))
  
          re = torch.zeros(
              ref[0].shape[0],
              ref[0].shape[1],
              ref[0].shape[2],
              num_spk,
              device=inf.device,
          )
          for i in range(num_spk):
              flags = [abs_ref[i] >= n for n in abs_ref]
              mask = reduce(lambda x, y: x * y, flags)
              mask = mask.int()
              re[mask == 1] = manifold_vector[i]
          re = re.contiguous().view(B, -1, num_spk)
      else:
          raise ValueError(
              f"Invalid loss type error: {self._loss_type}, "
              'the loss type must be "dpcl" or "mdc"'
          )
  
      V2 = (
          torch.matmul(torch.transpose(inf, 2, 1), inf)
          .pow(2)
          .sum(dim=(1, 2))
      )
      Y2 = (
          torch.matmul(torch.transpose(re, 2, 1).float(), re.float())
          .pow(2)
          .sum(dim=(1, 2))
      )
      VY = (
          torch.matmul(torch.transpose(inf, 2, 1), re.float())
          .pow(2)
          .sum(dim=(1, 2))
      )
  
      return V2 + Y2 - 2 * VY
  
imports: import math
  from abc import ABC, abstractmethod
  from functools import reduce
  import torch
  import torch.nn.functional
  from packaging.version import parse
  from espnet2.enh.layers.complex_utils import complex_norm, is_complex, new_complex_like
  from espnet2.enh.loss.criterions.abs_loss import AbsEnhLoss
label_desc: Use image node_id 4 for calling the FrequencyDomainDPCL obj's underlying member method code with example usage: obj.forward(ref, inf) and returns: unknown