class_docstr: Spectral convergence loss module.
class_docstr_tok: ["Spectral","convergence","loss","module","."]
docstr: Calculate forward propagation. It is assumed that x_mag and y_mag were padded to fit the maximum batch
  sequence length with silence, hence it is assumed that the norm of these extra padded values are 0. Therefore,
  input_lengths is not a argument unlike in LogSTFTMagnitudeLoss.
  Args:
      x_mag (Tensor): Magnitude spectrogram of predicted signal (B, #frames, #freq_bins).
      y_mag (Tensor): Magnitude spectrogram of groundtruth signal (B, #frames, #freq_bins).
  Returns:
      Tensor: Spectral convergence loss value.
docstr_tok: ["Calculate","forward","propagation",".","It","is","assumed","that","x_mag","and","y_mag","were","padded","to","fit","the","maximum","batch","sequence","length","with","silence",",","hence","it","is","assumed","that","the","norm","of","these","extra","padded","values","are","0",".","Therefore",",","input_lengths","is","not","a","argument","unlike","in","LogSTFTMagnitudeLoss",".","Args",":","x_mag","(","Tensor",")",":","Magnitude","spectrogram","of","predicted","signal","(","B",",","#","frames",",","#","freq_bins",")",".","y_mag","(","Tensor",")",":","Magnitude","spectrogram","of","groundtruth","signal","(","B",",","#","frames",",","#","freq_bins",")",".","Returns",":","Tensor",":","Spectral","convergence","loss","value","."]
code: def forward(self, *, x_mag, y_mag):
      """Calculate forward propagation. It is assumed that x_mag and y_mag were padded to fit the maximum batch
      sequence length with silence, hence it is assumed that the norm of these extra padded values are 0. Therefore,
      input_lengths is not a argument unlike in LogSTFTMagnitudeLoss.
      Args:
          x_mag (Tensor): Magnitude spectrogram of predicted signal (B, #frames, #freq_bins).
          y_mag (Tensor): Magnitude spectrogram of groundtruth signal (B, #frames, #freq_bins).
      Returns:
          Tensor: Spectral convergence loss value.
      """
      # Mean across time and freq_bins first
      loss = torch.norm(
          y_mag - x_mag, p="fro", dim=(1, 2)
      ) / torch.norm(y_mag, p="fro", dim=(1, 2))
      # Mean across batches
      loss = torch.mean(loss)
      return 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 3 for calling the SpectralConvergenceLoss obj's underlying member method code with example usage: obj.forward() and returns: loss