docstr: time-frequency absolute coherence loss.
  
  Reference:
      Independent Vector Analysis with Deep Neural Network Source Priors;
      Li et al 2020; https://arxiv.org/abs/2008.11273
  
  Args:
      ref: (Batch, T, F) or (Batch, T, C, F)
      inf: (Batch, T, F) or (Batch, T, C, F)
  Returns:
      loss: (Batch,)
docstr_tok: ["time-frequency","absolute","coherence","loss",".","Reference",":","Independent","Vector","Analysis","with","Deep","Neural","Network","Source","Priors",";","Li","et","al","2020",";","https",":","\/\/arxiv.org\/abs\/2008.11273","Args",":","ref",":","(","Batch",",","T",",","F",")","or","(","Batch",",","T",",","C",",","F",")","inf",":","(","Batch",",","T",",","F",")","or","(","Batch",",","T",",","C",",","F",")","Returns",":","loss",":","(","Batch",",",")"]
code: def forward(self, ref, inf) -> torch.Tensor:
      """time-frequency absolute coherence loss.
  
      Reference:
          Independent Vector Analysis with Deep Neural Network Source Priors;
          Li et al 2020; https://arxiv.org/abs/2008.11273
  
      Args:
          ref: (Batch, T, F) or (Batch, T, C, F)
          inf: (Batch, T, F) or (Batch, T, C, F)
      Returns:
          loss: (Batch,)
      """
      assert ref.shape == inf.shape, (ref.shape, inf.shape)
  
      if is_complex(ref) and is_complex(inf):
          # sqrt( E[|inf|^2] * E[|ref|^2] )
          denom = (
              complex_norm(ref, dim=1)
              * complex_norm(inf, dim=1)
              / ref.size(1)
              + EPS
          )
          coh = (inf * ref.conj()).mean(dim=1).abs() / denom
          if ref.dim() == 3:
              coh_loss = 1.0 - coh.mean(dim=1)
          elif ref.dim() == 4:
              coh_loss = 1.0 - coh.mean(dim=[1, 2])
          else:
              raise ValueError(
                  "Invalid input shape: ref={}, inf={}".format(
                      ref.shape, inf.shape
                  )
              )
      else:
          raise ValueError("`ref` and `inf` must be complex tensors.")
      return coh_loss
  
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 FrequencyDomainAbsCoherence obj's underlying member method code with example usage: obj.forward(ref, inf) and returns: coh_loss