code: def batch_mel_spectral_distortion(
      y1, y2, sr, normalize_type="path", mel_fn=None
  ):
      """
      https://arxiv.org/pdf/2011.03568.pdf
  
      Same as Mel Cepstral Distortion, but computed on log-mel spectrograms.
      """
      if mel_fn is None or mel_fn.sample_rate != sr:
          mel_fn = torchaudio.transforms.MelSpectrogram(
              sr,
              n_fft=int(0.05 * sr),
              win_length=int(0.05 * sr),
              hop_length=int(0.0125 * sr),
              f_min=20,
              n_mels=80,
              window_fn=torch.hann_window,
          ).to(y1[0].device)
      offset = 1e-6
      return batch_compute_distortion(
          y1,
          y2,
          sr,
          lambda y: torch.log(mel_fn(y) + offset).transpose(-1, -2),
          compute_rms_dist,
          normalize_type,
      )
  
file_path: fairseq/examples/speech_synthesis/utils.py
imports: import numpy
  import torch
  from scipy.interpolate import interp1d
  import torchaudio
  from fairseq.tasks.text_to_speech import batch_compute_distortion, compute_rms_dist
label_desc: Use image node_id 1 for calling a global function with example usage: batch_mel_spectral_distortion(y1, y2, sr, normalize_type, mel_fn) and returns: batch_compute_distortion