code: def test_td_speakerbeam_forward_backward(
      input_dim,
      layer,
      stack,
      bottleneck_dim,
      hidden_dim,
      skip_dim,
      kernel,
      causal,
      norm_type,
      pre_nonlinear,
      nonlinear,
      i_adapt_layer,
      adapt_layer_type,
      adapt_enroll_dim,
      use_spk_emb,
  ):
      if adapt_layer_type == "muladd":
          adapt_enroll_dim = adapt_enroll_dim * 2
      spk_emb_dim = 10
      model = TDSpeakerBeamExtractor(
          input_dim=input_dim,
          layer=layer,
          stack=stack,
          bottleneck_dim=bottleneck_dim,
          hidden_dim=hidden_dim,
          skip_dim=skip_dim,
          kernel=kernel,
          causal=causal,
          norm_type=norm_type,
          pre_nonlinear=pre_nonlinear,
          nonlinear=nonlinear,
          i_adapt_layer=i_adapt_layer,
          adapt_layer_type=adapt_layer_type,
          adapt_enroll_dim=adapt_enroll_dim,
          use_spk_emb=use_spk_emb,
          spk_emb_dim=spk_emb_dim,
      )
      model.train()
  
      x = torch.rand(2, 10, input_dim)
      x_lens = torch.tensor([10, 8], dtype=torch.long)
      if use_spk_emb:
          enroll = torch.rand(2, spk_emb_dim)
          enroll_lens = torch.tensor([1, 1])
      else:
          enroll = torch.rand(2, 20, input_dim)
          enroll_lens = torch.tensor([20, 18])
  
      masked, flens, others = model(
          x,
          ilens=x_lens,
          input_aux=enroll,
          ilens_aux=enroll_lens,
          suffix_tag="_spk1",
      )
      masked.abs().mean().backward()
  
imports: import pytest
  import torch
  from espnet2.enh.extractor.td_speakerbeam_extractor import TDSpeakerBeamExtractor
label_desc: Use image node_id 1 for calling a global function with example usage: test_td_speakerbeam_forward_backward(input_dim, layer, stack, bottleneck_dim, hidden_dim, skip_dim, kernel, causal, norm_type, pre_nonlinear, nonlinear, i_adapt_layer, adapt_layer_type, adapt_enroll_dim, use_spk_emb) without return types