code: def test_ray_tracing_input_errors(self):
      room = torch.tensor([3.0, 4.0, 5.0], dtype=self.dtype)
      source = torch.tensor([0.0, 0.0, 0.0], dtype=self.dtype)
      mic = torch.tensor([[1.0, 2.0, 3.0]], dtype=self.dtype)
  
      # baseline. This should not raise
      _ = F.ray_tracing(
          room=room, source=source, mic_array=mic, num_rays=10
      )
  
      # invlaid room shape
      for invalid in ([[4, 5]], [4, 5, 4, 5]):
          invalid = torch.tensor(invalid, dtype=self.dtype)
          with self.assertRaises(ValueError) as cm:
              F.ray_tracing(
                  room=invalid,
                  source=source,
                  mic_array=mic,
                  num_rays=10,
              )
  
          error = str(cm.exception)
          self.assertIn(
              "`room` must be a 1D Tensor with 3 elements.", error
          )
          self.assertIn(str(invalid.shape), error)
  
      # invalid microphone shape
      invalid = torch.tensor([[[3, 4]]], dtype=self.dtype)
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room, source=source, mic_array=invalid, num_rays=10
          )
  
      error = str(cm.exception)
      self.assertIn(
          "`mic_array` must be a 2D Tensor with shape (num_channels, 3).",
          error,
      )
      self.assertIn(str(invalid.shape), error)
  
      # incompatible dtypes
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room.to(torch.float64),
              source=source.to(torch.float32),
              mic_array=mic.to(torch.float32),
              num_rays=10,
          )
      error = str(cm.exception)
      self.assertIn(
          "dtype of `room`, `source` and `mic_array` must match.", error
      )
      self.assertIn("`room` (torch.float64)", error)
      self.assertIn("`source` (torch.float32)", error)
      self.assertIn("`mic_array` (torch.float32)", error)
  
      # invalid time configuration
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room,
              source=source,
              mic_array=mic,
              num_rays=10,
              time_thres=10,
              hist_bin_size=11,
          )
      error = str(cm.exception)
      self.assertIn(
          "`time_thres` must be greater than `hist_bin_size`.", error
      )
      self.assertIn("hist_bin_size=11", error)
      self.assertIn("time_thres=10", error)
  
      # invalid absorption shape 1D
      invalid_abs = torch.tensor([1, 2, 3], dtype=self.dtype)
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room,
              source=source,
              mic_array=mic,
              num_rays=10,
              absorption=invalid_abs,
          )
      error = str(cm.exception)
      self.assertIn(
          "The shape of `absorption` must be (6,) when", error
      )
      self.assertIn(str(invalid_abs.shape), error)
  
      # invalid absorption shape 2D
      invalid_abs = torch.tensor([[1, 2, 3]], dtype=self.dtype)
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room,
              source=source,
              mic_array=mic,
              num_rays=10,
              absorption=invalid_abs,
          )
      error = str(cm.exception)
      self.assertIn(
          "The shape of `absorption` must be (NUM_BANDS, 6) when", error
      )
      self.assertIn(str(invalid_abs.shape), error)
  
      # invalid scattering shape 1D
      invalid_scat = torch.tensor([1, 2, 3], dtype=self.dtype)
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room,
              source=source,
              mic_array=mic,
              num_rays=10,
              scattering=invalid_scat,
          )
      error = str(cm.exception)
      self.assertIn(
          "The shape of `scattering` must be (6,) when", error
      )
      self.assertIn(str(invalid_scat.shape), error)
  
      # invalid scattering shape 2D
      invalid_scat = torch.tensor([[1, 2, 3]], dtype=self.dtype)
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room,
              source=source,
              mic_array=mic,
              num_rays=10,
              scattering=invalid_scat,
          )
      error = str(cm.exception)
      self.assertIn(
          "The shape of `scattering` must be (NUM_BANDS, 6) when", error
      )
      self.assertIn(str(invalid_scat.shape), error)
  
      # Invalid absorption value
      for invalid_val in [
          -1.0,
          torch.tensor([i - 1.0 for i in range(6)]),
      ]:
          with self.assertRaises(ValueError) as cm:
              F.ray_tracing(
                  room=room,
                  source=source,
                  mic_array=mic,
                  num_rays=10,
                  absorption=invalid_val,
              )
  
              error = str(cm.exception)
              self.assertIn("`absorption` must be non-negative`")
  
      # Invalid scattering value
      for invalid_val in [
          -1.0,
          torch.tensor([i - 1.0 for i in range(6)]),
      ]:
          with self.assertRaises(ValueError) as cm:
              F.ray_tracing(
                  room=room,
                  source=source,
                  mic_array=mic,
                  num_rays=10,
                  scattering=invalid_val,
              )
  
              error = str(cm.exception)
              self.assertIn("`scattering` must be non-negative`")
  
      # incompatible scattering and absorption
      abs_ = torch.zeros((7, 6), dtype=self.dtype)
      scat = torch.zeros((5, 6), dtype=self.dtype)
      with self.assertRaises(ValueError) as cm:
          F.ray_tracing(
              room=room,
              source=source,
              mic_array=mic,
              num_rays=10,
              absorption=abs_,
              scattering=scat,
          )
      error = str(cm.exception)
      self.assertIn(
          "`absorption` and `scattering` must be broadcastable to the same number of bands and walls",
          error,
      )
      self.assertIn(f"absorption={abs_.shape}", error)
      self.assertIn(f"scattering={scat.shape}", error)
  
      # Make sure passing different shapes for absorption or scattering doesn't raise an error
      # float and tensor
      F.ray_tracing(
          room=room,
          source=source,
          mic_array=mic,
          num_rays=10,
          absorption=0.1,
          scattering=torch.rand((5, 6), dtype=self.dtype),
      )
      F.ray_tracing(
          room=room,
          source=source,
          mic_array=mic,
          num_rays=10,
          absorption=torch.rand((7, 6), dtype=self.dtype),
          scattering=0.1,
      )
      # per-wall only and per-band + per-wall
      F.ray_tracing(
          room=room,
          source=source,
          mic_array=mic,
          num_rays=10,
          absorption=torch.rand(6, dtype=self.dtype),
          scattering=torch.rand(7, 6, dtype=self.dtype),
      )
      F.ray_tracing(
          room=room,
          source=source,
          mic_array=mic,
          num_rays=10,
          absorption=torch.rand(7, 6, dtype=self.dtype),
          scattering=torch.rand(6, dtype=self.dtype),
      )
  
imports: import torch
  import torchaudio.prototype.functional
  from parameterized import param, parameterized
  from torchaudio_unittest.common_utils import nested_params, TestBaseMixin
  from .dsp_utils import exp_sigmoid, freq_ir, oscillator_bank, sinc_ir
label_desc: Use image node_id 16 for calling the FunctionalTestImpl obj's underlying member method code with example usage: obj.test_ray_tracing_input_errors() without return types