code: def _bss_eval_images_snr(
      preds: Tensor, target: Tensor, 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]
      if zero_mean:
          target = target - torch.mean(target, dim=-1, keepdim=True)
          preds = preds - torch.mean(preds, dim=-1, keepdim=True)
      target = target.detach().cpu().numpy()
      preds = preds.detach().cpu().numpy()
      mss = []
      for i in range(preds.shape[0]):
          ms = []
          for j in range(preds.shape[1]):
              snr_v = mir_eval_bss_eval_images(
                  [target[i, j]],
                  [preds[i, j]],
                  compute_permutation=True,
              )[0][0]
              ms.append(snr_v)
          mss.append(ms)
      return torch.tensor(mss)
  
imports: from functools import partial
  from typing import Callable
  import pytest
  import torch
  from mir_eval.separation import bss_eval_images
  from torch import Tensor
  from torchmetrics.audio import SignalNoiseRatio
  from torchmetrics.functional.audio import signal_noise_ratio
  from unittests import _Input
  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: _bss_eval_images_snr(preds, target, zero_mean) and returns: torch