class_docstr: Multi-Resolution L1 time-domain + STFT mag loss
  
  Reference:
  Lu, Y. J., Cornell, S., Chang, X., Zhang, W., Li, C., Ni, Z., ... & Watanabe, S.
  Towards Low-Distortion Multi-Channel Speech Enhancement:
  The ESPNET-Se Submission to the L3DAS22 Challenge. ICASSP 2022 p. 9201-9205.
  
  Attributes:
      window_sz: (list)
          list of STFT window sizes.
      hop_sz: (list, optional)
          list of hop_sizes, default is each window_sz // 2.
      eps: (float)
          stability epsilon
      time_domain_weight: (float)
          weight for time domain loss.
      normalize_variance (bool)
          whether or not to normalize the variance when calculating the loss.
      reduction (str)
          select from "sum" and "mean"
class_docstr_tok: ["Multi-Resolution","L1","time-domain","+","STFT","mag","loss","Reference",":","Lu",",","Y.","J.",",","Cornell",",","S.",",","Chang",",","X.",",","Zhang",",","W.",",","Li",",","C.",",","Ni",",","Z.",",","...","&","Watanabe",",","S.","Towards","Low-Distortion","Multi-Channel","Speech","Enhancement",":","The","ESPNET-Se","Submission","to","the","L3DAS22","Challenge",".","ICASSP","2022","p.","9201-9205",".","Attributes",":","window_sz",":","(","list",")","list","of","STFT","window","sizes",".","hop_sz",":","(","list",",","optional",")","list","of","hop_sizes",",","default","is","each","window_sz","\/\/","2.","eps",":","(","float",")","stability","epsilon","time_domain_weight",":","(","float",")","weight","for","time","domain","loss",".","normalize_variance","(","bool",")","whether","or","not","to","normalize","the","variance","when","calculating","the","loss",".","reduction","(","str",")","select","from","``","sum","''","and","``","mean","''"]
docstr: forward.
  
  Args:
      target: (Batch, T)
      estimate: (Batch, T)
  Returns:
      loss: (Batch,)
docstr_tok: ["forward",".","Args",":","target",":","(","Batch",",","T",")","estimate",":","(","Batch",",","T",")","Returns",":","loss",":","(","Batch",",",")"]
code: def forward(
      self,
      target: torch.Tensor,
      estimate: torch.Tensor,
  ):
      """forward.
  
      Args:
          target: (Batch, T)
          estimate: (Batch, T)
      Returns:
          loss: (Batch,)
      """
      assert target.shape == estimate.shape, (
          target.shape,
          estimate.shape,
      )
      half_precision = (torch.float16, torch.bfloat16)
      if (
          target.dtype in half_precision
          or estimate.dtype in half_precision
      ):
          target = target.float()
          estimate = estimate.float()
      if self.normalize_variance:
          target = target / torch.std(target, dim=1, keepdim=True)
          estimate = estimate / torch.std(estimate, dim=1, keepdim=True)
      # shape bsz, samples
      scaling_factor = torch.sum(
          estimate * target, -1, keepdim=True
      ) / (torch.sum(estimate**2, -1, keepdim=True) + self.eps)
      if self.reduction == "sum":
          time_domain_loss = torch.sum(
              (estimate * scaling_factor - target).abs(), dim=-1
          )
      elif self.reduction == "mean":
          time_domain_loss = torch.mean(
              (estimate * scaling_factor - target).abs(), dim=-1
          )
  
      if len(self.stft_encoders) == 0:
          return time_domain_loss
      else:
          spectral_loss = torch.zeros_like(time_domain_loss)
          for stft_enc in self.stft_encoders:
              target_mag = self.get_magnitude(stft_enc(target)[0])
              estimate_mag = self.get_magnitude(
                  stft_enc(estimate * scaling_factor)[0]
              )
              if self.reduction == "sum":
                  c_loss = torch.sum(
                      (estimate_mag - target_mag).abs(), dim=(1, 2)
                  )
              elif self.reduction == "mean":
                  c_loss = torch.mean(
                      (estimate_mag - target_mag).abs(), dim=(1, 2)
                  )
              spectral_loss += c_loss
  
          return time_domain_loss * self.time_domain_weight + (
              1 - self.time_domain_weight
          ) * spectral_loss / len(self.stft_encoders)
  
imports: import logging
  import math
  from abc import ABC
  import ci_sdr
  import fast_bss_eval
  import torch
  from packaging.version import parse
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.loss.criterions.abs_loss import AbsEnhLoss
  from espnet2.layers.stft import Stft
label_desc: Use image node_id 4 for calling the MultiResL1SpecLoss obj's underlying member method code with example usage: obj.forward(target, estimate) and returns: time_domain_loss, unknown