code: def test_tf_domain_criterion_forward(
      criterion_class, mask_type, compute_on_mask, input_ch
  ):
      criterion = criterion_class(
          compute_on_mask=compute_on_mask, mask_type=mask_type
      )
      complex_wrapper = (
          torch.complex if is_torch_1_9_plus else ComplexTensor
      )
  
      batch = 2
      shape = (
          (batch, 10, 200)
          if input_ch == 1
          else (batch, 10, input_ch, 200)
      )
      ref_spec = [
          complex_wrapper(torch.rand(*shape), torch.rand(*shape))
      ]
      mix_spec = complex_wrapper(torch.rand(*shape), torch.rand(*shape))
      noise_spec = complex_wrapper(
          torch.rand(*shape), torch.rand(*shape)
      )
  
      if compute_on_mask:
          inf = [torch.rand(*shape)]
          ref = criterion.create_mask_label(
              mix_spec, ref_spec, noise_spec=noise_spec
          )
          loss = criterion(ref[0], inf[0])
      else:
          inf_spec = [
              complex_wrapper(torch.rand(*shape), torch.rand(*shape))
          ]
          loss = criterion(ref_spec[0], inf_spec[0])
  
      assert loss.shape == (batch,), (
          "Invlid loss shape with " + criterion.name
      )
  
file_path: espnet/test/espnet2/enh/loss/criterions/test_tf_domain.py
imports: import pytest
  import torch
  from packaging.version import parse
  from torch_complex import ComplexTensor
  from espnet2.enh.loss.criterions.tf_domain import FrequencyDomainAbsCoherence, FrequencyDomainCrossEntropy, FrequencyDomainDPCL, FrequencyDomainL1, FrequencyDomainMSE
label_desc: Use image node_id 1 for calling a global function with example usage: test_tf_domain_criterion_forward(criterion_class, mask_type, compute_on_mask, input_ch) without return types