docstr: Test construction of convolutional tensor in WPE. Compare against
  reference implementation convmtx_mc.
docstr_tok: ["Test","construction","of","convolutional","tensor","in","WPE",".","Compare","against","reference","implementation","convmtx_mc","."]
code: def test_wpe_convtensor(
      self, num_channels: int, filter_length: int, delay: int
  ):
      """Test construction of convolutional tensor in WPE. Compare against
      reference implementation convmtx_mc.
      """
      atol = 1e-6
      random_seed = 42
      num_examples = 10
      batch_size = 8
      num_subbands = 15
      num_frames = 21
  
      _rng = np.random.default_rng(seed=random_seed)
      input_size = (batch_size, num_channels, num_subbands, num_frames)
  
      for n in range(num_examples):
          X = _rng.normal(size=input_size) + 1j * _rng.normal(
              size=input_size
          )
  
          # Reference
          tilde_X_ref = np.zeros(
              (
                  batch_size,
                  num_subbands,
                  num_frames,
                  num_channels * filter_length,
              ),
              dtype=X.dtype,
          )
          for b in range(batch_size):
              for f in range(num_subbands):
                  tilde_X_ref[b, f, :, :] = convmtx_mc_numpy(
                      X[b, :, f, :].transpose(),
                      filter_length=filter_length,
                      delay=delay,
                  )
  
          # UUT
          tilde_X_uut = WPEFilter.convtensor(
              torch.tensor(X), filter_length=filter_length, delay=delay
          )
  
          # UUT has vectors arranged in a tensor shape with permuted columns
          # Reorganize to match the shape and column permutation
          tilde_X_uut = WPEFilter.permute_convtensor(tilde_X_uut)
          tilde_X_uut = tilde_X_uut.cpu().detach().numpy()
  
          assert np.allclose(
              tilde_X_uut, tilde_X_ref, atol=atol
          ), f"Example {n}: comparison failed"
  
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 TestMaskBasedDereverb obj's underlying member method code with example usage: obj.test_wpe_convtensor(num_channels, filter_length, delay) without return types