class_docstr: SISNR loss.
  
  Input should be [B, C, T], output is scalar.
  
  ..Warning:: This function returns the opposite of the SI-SNR (e.g. `-1 * regular_SI_SNR`).
      Consequently, lower scores are better in terms of reconstruction quality,
      in particular, it should be negative if training goes well. This done this way so
      that this module can also be used as a loss function for training model.
  
  Args:
      sample_rate (int): Sample rate.
      segment (float or None): Evaluate on chunks of that many seconds. If None, evaluate on
          entire audio only.
      overlap (float): Overlap between chunks, i.e. 0.5 = 50 % overlap.
      epsilon (float): Epsilon value for numerical stability.
code: def forward(
      self, out_sig: torch.Tensor, ref_sig: torch.Tensor
  ) -> torch.Tensor:
      B, C, T = ref_sig.shape
      assert ref_sig.shape == out_sig.shape
  
      if self.segment is None:
          frame = T
          stride = T
      else:
          frame = int(self.segment * self.sample_rate)
          stride = int(frame * (1 - self.overlap))
  
      epsilon = self.epsilon * frame  # make epsilon prop to frame size.
  
      gt = _unfold(ref_sig, frame, stride)
      est = _unfold(out_sig, frame, stride)
      if self.segment is None:
          assert gt.shape[-1] == 1
  
      gt = _center(gt)
      est = _center(est)
      dot = torch.einsum("bcft,bcft->bcf", gt, est)
  
      proj = dot[:, :, :, None] * gt / (epsilon + _norm2(gt))
      noise = est - proj
  
      sisnr = 10 * (
          torch.log10(epsilon + _norm2(proj))
          - torch.log10(epsilon + _norm2(noise))
      )
      return -1 * sisnr[..., 0].mean()
  
file_path: audiocraft/audiocraft/losses/sisnr.py
imports: import math
  import typing
  import torch
  from torch import nn
  from torch.nn import functional
label_desc: Use image node_id 2 for calling the SISNR obj's underlying member method code with example usage: obj.forward(out_sig, ref_sig) and returns: unknown