class_docstr: STFT loss module.
class_docstr_tok: ["STFT","loss","module","."]
docstr: Calculate forward propagation.
  Args:
      x (Tensor): Predicted signal (B, T).
      y (Tensor): Groundtruth signal (B, T).
      input_lengths (Tensor): Length of groundtruth sample in samples (B).
  Returns:
      Tensor: Spectral convergence loss value.
      Tensor: Log STFT magnitude loss value.
docstr_tok: ["Calculate","forward","propagation",".","Args",":","x","(","Tensor",")",":","Predicted","signal","(","B",",","T",")",".","y","(","Tensor",")",":","Groundtruth","signal","(","B",",","T",")",".","input_lengths","(","Tensor",")",":","Length","of","groundtruth","sample","in","samples","(","B",")",".","Returns",":","Tensor",":","Spectral","convergence","loss","value",".","Tensor",":","Log","STFT","magnitude","loss","value","."]
code: def forward(self, *, x, y, input_lengths=None):
      """Calculate forward propagation.
      Args:
          x (Tensor): Predicted signal (B, T).
          y (Tensor): Groundtruth signal (B, T).
          input_lengths (Tensor): Length of groundtruth sample in samples (B).
      Returns:
          Tensor: Spectral convergence loss value.
          Tensor: Log STFT magnitude loss value.
      """
      if self.window.device != x.device:
          self.window = self.window.to(x.device)
      x_mag = stft(
          x,
          self.fft_size,
          self.shift_size,
          self.win_length,
          self.window,
      )
      y_mag = stft(
          y,
          self.fft_size,
          self.shift_size,
          self.win_length,
          self.window,
      )
      sc_loss = self.spectral_convergence_loss(x_mag=x_mag, y_mag=y_mag)
      if input_lengths is not None:
          input_lengths = (
              torch.floor(input_lengths / float(self.shift_size)) + 1
          )
          assert (
              max(input_lengths) == x_mag.shape[1]
          ), f"{max(input_lengths)} != {x_mag.shape[1]}"
      mag_loss = self.log_stft_magnitude_loss(
          x_mag=x_mag, y_mag=y_mag, input_lengths=input_lengths
      )
  
      return sc_loss, mag_loss
  
imports: import torch
  import torch.nn.functional
  from nemo.core.classes import Loss, typecheck
  from nemo.core.neural_types.elements import AudioSignal, LengthsType, LossType, SpectrogramType
  from nemo.core.neural_types.neural_type import NeuralType
label_desc: Use image node_id 4 for calling the STFTLoss obj's underlying member method code with example usage: obj.forward() and returns: sc_loss,  mag_loss