code: def dvae_wav_to_mel(
      wav,
      mel_norms_file="../experiments/clips_mel_norms.pth",
      mel_norms=None,
      device=torch.device("cpu"),
  ):
      mel_stft = torchaudio.transforms.MelSpectrogram(
          n_fft=1024,
          hop_length=256,
          win_length=1024,
          power=2,
          normalized=False,
          sample_rate=22050,
          f_min=0,
          f_max=8000,
          n_mels=80,
          norm="slaney",
      ).to(device)
      wav = wav.to(device)
      mel = mel_stft(wav)
      mel = torch.log(torch.clamp(mel, min=1e-5))
      if mel_norms is None:
          mel_norms = torch.load(mel_norms_file, map_location=device)
      mel = mel / mel_norms.unsqueeze(0).unsqueeze(-1)
      return mel
  
imports: import functools
  from math import sqrt
  import torch
  import torch.distributed
  import torch.nn
  import torch.nn.functional
  import torchaudio
  from einops import rearrange
label_desc: Use image node_id 3 for calling a global function with example usage: dvae_wav_to_mel(wav, mel_norms_file, mel_norms, device) and returns: mel