code: def test_neural_beamformer_bf_output(
      num_spk,
      use_noise_mask,
      beamformer_type,
      diagonal_loading,
      mask_flooring,
      use_torch_solver,
  ):
      if num_spk == 1 and beamformer_type in (
          "lcmv",
          "lcmp",
          "wlcmp",
          "mvdr_tfs",
          "mvdr_tfs_souden",
      ):
          # only support multiple-source cases
          return
  
      ch = 2
      inputs = random_speech[..., :ch].float()
      ilens = torch.LongTensor([16, 12])
  
      torch.random.manual_seed(0)
      stft = STFTEncoder(
          n_fft=8,
          hop_length=2,
          use_builtin_complex=is_torch_1_12_1_plus,
      )
      model = NeuralBeamformer(
          stft.output_dim,
          num_spk=num_spk,
          use_wpe=False,
          taps=2,
          delay=3,
          use_beamformer=True,
          blayers=2,
          bunits=2,
          bprojs=2,
          badim=2,
          use_noise_mask=use_noise_mask,
          beamformer_type=beamformer_type,
          diagonal_loading=diagonal_loading,
          mask_flooring=mask_flooring,
          use_torch_solver=use_torch_solver,
          use_torchaudio_api=is_torch_1_12_1_plus,
      )
      model.eval()
      input_spectrum, flens = stft(inputs, ilens)
      specs, _, others = model(input_spectrum, flens)
      assert isinstance(others, dict)
      if use_noise_mask:
          assert "mask_noise1" in others
          assert (
              others["mask_noise1"].shape == others["mask_spk1"].shape
          )
      assert isinstance(specs, list)
      assert len(specs) == num_spk
      for n in range(1, num_spk + 1):
          assert "mask_spk{}".format(n) in others, others.keys()
          assert others["mask_spk{}".format(n)].shape[-2] == ch
          assert (
              specs[n - 1].shape
              == others["mask_spk{}".format(n)][..., 0, :].shape
          )
          assert specs[n - 1].shape == input_spectrum[..., 0, :].shape
          if is_torch_complex_tensor(specs[n - 1]):
              assert specs[n - 1].dtype == torch.complex64
          else:
              assert specs[n - 1].dtype == torch.float
  
file_path: espnet/test/espnet2/enh/separator/test_beamformer.py
imports: import numpy
  import pytest
  import torch
  from packaging.version import parse
  from espnet2.enh.encoder.stft_encoder import STFTEncoder
  from espnet2.enh.layers.complex_utils import is_torch_complex_tensor
  from espnet2.enh.layers.dnn_beamformer import BEAMFORMER_TYPES
  from espnet2.enh.separator.neural_beamformer import NeuralBeamformer
label_desc: Use image node_id 3 for calling a global function with example usage: test_neural_beamformer_bf_output(num_spk, use_noise_mask, beamformer_type, diagonal_loading, mask_flooring, use_torch_solver) without return types