docstr: Test masking of the reference channel.
          
docstr_tok: ["Test","masking","of","the","reference","channel","."]
code: def test_mask_reference_channel(
      self, fft_length: int, num_channels: int, num_masks: int
  ):
      """Test masking of the reference channel."""
      if num_channels == 1:
          # Only one channel available
          ref_channels = [0]
      else:
          # Use first or last channel for MC signals
          ref_channels = [0, num_channels - 1]
  
      atol = 1e-6
      batch_size = 8
      num_samples = fft_length * 50
      num_examples = 10
      random_seed = 42
  
      _rng = np.random.default_rng(seed=random_seed)
  
      hop_length = fft_length // 4
      audio2spec = AudioToSpectrogram(
          fft_length=fft_length, hop_length=hop_length
      )
  
      for ref_channel in ref_channels:
          mask_processor = MaskReferenceChannel(ref_channel=ref_channel)
  
          for n in range(num_examples):
              x = _rng.normal(
                  size=(batch_size, num_channels, num_samples)
              )
  
              spec, spec_len = audio2spec(
                  input=torch.Tensor(x),
                  input_length=torch.Tensor([num_samples] * batch_size),
              )
  
              # Randomly-generated mask
              mask = _rng.uniform(
                  low=0.0,
                  high=1.0,
                  size=(
                      batch_size,
                      num_masks,
                      audio2spec.num_subbands,
                      spec.shape[-1],
                  ),
              )
  
              # UUT output
              out, _ = mask_processor(
                  input=spec,
                  input_length=spec_len,
                  mask=torch.tensor(mask),
              )
              out_np = out.cpu().detach().numpy()
  
              # Golden output
              spec_np = spec.cpu().detach().numpy()
              out_golden = np.zeros_like(mask, dtype=spec_np.dtype)
              for m in range(num_masks):
                  out_golden[:, m, ...] = (
                      spec_np[:, ref_channel, ...] * mask[:, m, ...]
                  )
  
              # Compare shape
              assert (
                  out_np.shape == out_golden.shape
              ), f"Output shape not matching for example {n}"
  
              # Compare values
              assert np.allclose(
                  out_np, out_golden, atol=atol
              ), f"Output not matching for example {n}"
  
imports: import importlib
  from typing import Optional
  import numpy
  import pytest
  import torch
  from nemo.collections.asr.modules.audio_modules import MaskBasedDereverbWPE, MaskEstimatorFlexChannels, MaskEstimatorGSS, MaskReferenceChannel, SpectrogramToMultichannelFeatures, WPEFilter
  from nemo.collections.asr.modules.audio_preprocessing import AudioToSpectrogram
  from nemo.collections.asr.parts.utils.audio_utils import convmtx_mc_numpy
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling the TestMaskBasedProcessor obj's underlying member method code with example usage: obj.test_mask_reference_channel(fft_length, num_channels, num_masks) without return types