code: def _sdr_original_batch(
      preds: Tensor, target: Tensor, compute_permutation: bool = False
  ) -> Tensor:
      # shape: preds [BATCH_SIZE, spk, Time] , target [BATCH_SIZE, spk, Time]
      # or shape: preds [NUM_BATCHES*BATCH_SIZE, spk, Time] , target [NUM_BATCHES*BATCH_SIZE, spk, Time]
      target = target.detach().cpu().numpy()
      preds = preds.detach().cpu().numpy()
      mss = []
      for b in range(preds.shape[0]):
          sdr_val_np, _, _, _ = bss_eval_sources(
              target[b], preds[b], compute_permutation
          )
          mss.append(sdr_val_np)
      return torch.tensor(np.array(mss))
  
imports: from functools import partial
  from typing import Callable
  import numpy
  import pytest
  import torch
  from mir_eval.separation import bss_eval_sources
  from scipy.io import wavfile
  from torch import Tensor
  from torchmetrics.audio import SignalDistortionRatio
  from torchmetrics.functional import signal_distortion_ratio
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_1_11
  from unittests import _Input
  from unittests.audio import _SAMPLE_AUDIO_SPEECH, _SAMPLE_AUDIO_SPEECH_BAB_DB, _SAMPLE_NUMPY_ISSUE_895
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 1 for calling a global function with example usage: _sdr_original_batch(preds, target, compute_permutation) and returns: torch