code: def test_error_on_shape(
      metric_class=SourceAggregatedSignalDistortionRatio,
  ):
      """Test that error is raised on different shapes of input."""
      metric = metric_class()
      with pytest.raises(
          RuntimeError,
          match="Predictions and targets are expected to have the same shape",
      ):
          metric(torch.randn(100), torch.randn(50))
  
      with pytest.raises(
          RuntimeError,
          match="The preds and target should have the shape (..., spk, time)*",
      ):
          metric(torch.randn(100), torch.randn(100))
  
file_path: torchmetrics/tests/unittests/audio/test_sa_sdr.py
imports: from functools import partial
  import pytest
  import torch
  from torch import Tensor
  from torchmetrics.audio import SourceAggregatedSignalDistortionRatio
  from torchmetrics.functional.audio import scale_invariant_signal_distortion_ratio, signal_noise_ratio, source_aggregated_signal_distortion_ratio
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 3 for calling a global function with example usage: test_error_on_shape(metric_class) without return types