docstr: Test simulate_rir_ism function in the case where absorption coefficients are identical for all walls.
docstr_tok: ["Test","simulate_rir_ism","function","in","the","case","where","absorption","coefficients","are","identical","for","all","walls","."]
code: def test_simulate_rir_ism_single_band(self, channel):
      """Test simulate_rir_ism function in the case where absorption coefficients are identical for all walls."""
      room_dim = torch.rand(3, dtype=self.dtype, device=self.device) + 5
      mic_array = (
          torch.rand(channel, 3, dtype=self.dtype, device=self.device)
          + 1
      )
      source = torch.rand(3, dtype=self.dtype, device=self.device) + 4
      max_order = 3
      # absorption is set as a float value indicating absorption coefficients are the same for every wall.
      absorption = 0.5
      # compute rir signal by torchaudio implementation
      actual = F.simulate_rir_ism(
          room_dim, source, mic_array, max_order, absorption
      )
      # compute rir signal by pyroomacoustics
      room = pra.ShoeBox(
          room_dim.detach().numpy(),
          fs=16000,
          materials=pra.Material(absorption),
          max_order=max_order,
          ray_tracing=False,
          air_absorption=False,
      )
      # mic_locs is a numpy array of dimension `(3, channel)`.
      mic_locs = mic_array.transpose(0, 1).double().detach().numpy()
      room.add_microphone_array(mic_locs)
      room.add_source(source.tolist())
      room.compute_rir()
      max_len = max(room.rir[i][0].shape[0] for i in range(channel))
      expected = torch.zeros(
          channel, max_len, dtype=self.dtype, device=self.device
      )
      for i in range(channel):
          expected[i, 0 : room.rir[i][0].shape[0]] = torch.from_numpy(
              room.rir[i][0]
          )
  
      self.assertEqual(expected, actual, atol=1e-3, rtol=1e-3)
  
file_path: audio/test/torchaudio_unittest/prototype/functional/pyroomacoustics_compatibility_test.py
imports: import math
  import numpy
  import torch
  import torchaudio.prototype.functional
  from parameterized import parameterized
  from torchaudio._internal import module_utils
  from torchaudio_unittest.common_utils import PytorchTestCase, skipIfNoModule, skipIfNoRIR
label_desc: Use image node_id 1 for calling the CompatibilityTest obj's underlying member method code with example usage: obj.test_simulate_rir_ism_single_band(channel) without return types