code: def _average_metric(
      preds: Tensor,
      target: Tensor,
      scale_invariant: bool,
      zero_mean: bool,
  ):
      # shape: preds [BATCH_SIZE, 1, Time] , target [BATCH_SIZE, 1, Time]
      # or shape: preds [NUM_BATCHES*BATCH_SIZE, 1, Time] , target [NUM_BATCHES*BATCH_SIZE, 1, Time]
      return _ref_metric(
          preds, target, scale_invariant, zero_mean
      ).mean()
  
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 2 for calling a global function with example usage: _average_metric(preds, target, scale_invariant, zero_mean) and returns: _ref_metric