code: def test_time_domain_l1_l2_forward(criterion_class, input_ch):
      criterion = criterion_class()
  
      batch = 2
      shape = (batch, 200) if input_ch == 1 else (batch, 200, input_ch)
      inf = torch.rand(*shape)
      ref = torch.rand(*shape)
  
      loss = criterion(ref, inf)
      assert loss.shape == (batch,), (
          "Invlid loss shape with " + criterion.name
      )
  
      with pytest.raises(ValueError):
          if input_ch == 1:
              loss = criterion(
                  ref[..., None, None], inf[..., None, None]
              )
          else:
              loss = criterion(ref[..., None], inf[..., None])
  
imports: import pytest
  import torch
  from packaging.version import parse
  from espnet2.enh.loss.criterions.time_domain import CISDRLoss, MultiResL1SpecLoss, SDRLoss, SISNRLoss, SNRLoss, TimeDomainL1, TimeDomainMSE
label_desc: Use image node_id 2 for calling a global function with example usage: test_time_domain_l1_l2_forward(criterion_class, input_ch) without return types