class_docstr: Loss to keep SpectrogramEnhancer from generating extra sounds.
  L1 distance on x0.25 Mel scale (20 bins for typical 80-bin scale)
class_docstr_tok: ["Loss","to","keep","SpectrogramEnhancer","from","generating","extra","sounds",".","L1","distance","on","x0.25","Mel","scale","(","20","bins","for","typical","80-bin","scale",")"]
code: def __call__(self, condition, output, lengths):
      *_, w, h = condition.shape
      w, h = w // 4, h
  
      condition = F.interpolate(
          condition, size=(w, h), mode="bilinear", antialias=True
      )
      output = F.interpolate(
          output, size=(w, h), mode="bilinear", antialias=True
      )
  
      dist = (condition - output).abs()
      dist = mask_sequence_tensor(dist, lengths)
      return (dist / rearrange(lengths, "b -> b 1 1 1")).sum(
          dim=-1
      ).mean() * self.weight
  
file_path: NeMo/nemo/collections/tts/losses/spectrogram_enhancer_losses.py
imports: import torch
  import torch.nn.functional
  from einops import rearrange
  from torch.autograd import grad
  from nemo.collections.tts.parts.utils.helpers import mask_sequence_tensor
label_desc: Use image node_id 2 for calling the ConsistencyLoss obj's underlying member method code with example usage: obj.__call__(condition, output, lengths) and returns: unknown