code: def test_dan_separator_forward_backward_complex(
      input_dim,
      rnn_type,
      layer,
      unit,
      dropout,
      num_spk,
      emb_D,
      nonlinear,
  ):
      model = DANSeparator(
          input_dim=input_dim,
          rnn_type=rnn_type,
          layer=layer,
          unit=unit,
          dropout=dropout,
          num_spk=num_spk,
          emb_D=emb_D,
          nonlinear=nonlinear,
      )
      model.train()
  
      real = torch.rand(2, 10, input_dim)
      imag = torch.rand(2, 10, input_dim)
      x = ComplexTensor(real, imag)
      x_lens = torch.tensor([10, 8], dtype=torch.long)
  
      o = []
      for i in range(num_spk):
          o.append(ComplexTensor(real, imag))
  
      sep_others = {}
      sep_others["feature_ref"] = o
  
      masked, flens, others = model(
          x, ilens=x_lens, additional=sep_others
      )
  
      assert isinstance(masked[0], ComplexTensor)
      assert len(masked) == num_spk
  
      masked[0].abs().mean().backward()
  
file_path: espnet/test/espnet2/enh/separator/test_dan_separator.py
imports: import pytest
  import torch
  from torch import Tensor
  from torch_complex import ComplexTensor
  from espnet2.enh.separator.dan_separator import DANSeparator
label_desc: Use image node_id 1 for calling a global function with example usage: test_dan_separator_forward_backward_complex(input_dim, rnn_type, layer, unit, dropout, num_spk, emb_D, nonlinear) without return types