class_docstr: A ready-to-use wrapper for HiFiGAN (mel_spec -> waveform).
  Arguments
  ---------
  hparams
      Hyperparameters (from HyperPyYAML)
  Example
  -------
  >>> tmpdir_vocoder = getfixture('tmpdir') / "vocoder"
  >>> hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-ljspeech", savedir=tmpdir_vocoder)
  >>> mel_specs = torch.rand(2, 80,298)
  >>> waveforms = hifi_gan.decode_batch(mel_specs)
  >>> # You can use the vocoder coupled with a TTS system
  >>> # Initialize TTS (tacotron2)
  >>> tmpdir_tts = getfixture('tmpdir') / "tts"
  >>> from speechbrain.inference.TTS import Tacotron2
  >>> tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", savedir=tmpdir_tts)
  >>> # Running the TTS
  >>> mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")
  >>> # Running Vocoder (spectrogram-to-waveform)
  >>> waveforms = hifi_gan.decode_batch(mel_output)
class_docstr_tok: ["A","ready-to-use","wrapper","for","HiFiGAN","(","mel_spec","-",">","waveform",")",".","Arguments","--","--","--","--","-","hparams","Hyperparameters","(","from","HyperPyYAML",")","Example","--","--","--","-",">",">",">","tmpdir_vocoder","=","getfixture","(","'tmpdir","'",")","\/","``","vocoder","''",">",">",">","hifi_gan","=","HIFIGAN.from_hparams","(","source=","''","speechbrain\/tts-hifigan-ljspeech","''",",","savedir=tmpdir_vocoder",")",">",">",">","mel_specs","=","torch.rand","(","2",",","80,298",")",">",">",">","waveforms","=","hifi_gan.decode_batch","(","mel_specs",")",">",">",">","#","You","can","use","the","vocoder","coupled","with","a","TTS","system",">",">",">","#","Initialize","TTS","(","tacotron2",")",">",">",">","tmpdir_tts","=","getfixture","(","'tmpdir","'",")","\/","``","tts","''",">",">",">","from","speechbrain.inference.TTS","import","Tacotron2",">",">",">","tacotron2","=","Tacotron2.from_hparams","(","source=","''","speechbrain\/tts-tacotron2-ljspeech","''",",","savedir=tmpdir_tts",")",">",">",">","#","Running","the","TTS",">",">",">","mel_output",",","mel_length",",","alignment","=","tacotron2.encode_text","(","``","Mary","had","a","little","lamb","''",")",">",">",">","#","Running","Vocoder","(","spectrogram-to-waveform",")",">",">",">","waveforms","=","hifi_gan.decode_batch","(","mel_output",")"]
docstr: Computes waveforms from a single mel-spectrogram
  Arguments
  ---------
  spectrogram: torch.Tensor
      mel-spectrogram [mels, time]
  Returns
  -------
  waveform: torch.Tensor
      waveform [1, time]
  audio can be saved by:
  >>> import torchaudio
  >>> waveform = torch.rand(1, 666666)
  >>> sample_rate = 22050
  >>> torchaudio.save(str(getfixture('tmpdir') / "test.wav"), waveform, sample_rate)
docstr_tok: ["Computes","waveforms","from","a","single","mel-spectrogram","Arguments","--","--","--","--","-","spectrogram",":","torch.Tensor","mel-spectrogram","[","mels",",","time","]","Returns","--","--","--","-","waveform",":","torch.Tensor","waveform","[","1",",","time","]","audio","can","be","saved","by",":",">",">",">","import","torchaudio",">",">",">","waveform","=","torch.rand","(","1",",","666666",")",">",">",">","sample_rate","=","22050",">",">",">","torchaudio.save","(","str","(","getfixture","(","'tmpdir","'",")","\/","``","test.wav","''",")",",","waveform",",","sample_rate",")"]
code: def decode_spectrogram(self, spectrogram):
      """Computes waveforms from a single mel-spectrogram
      Arguments
      ---------
      spectrogram: torch.Tensor
          mel-spectrogram [mels, time]
      Returns
      -------
      waveform: torch.Tensor
          waveform [1, time]
      audio can be saved by:
      >>> import torchaudio
      >>> waveform = torch.rand(1, 666666)
      >>> sample_rate = 22050
      >>> torchaudio.save(str(getfixture('tmpdir') / "test.wav"), waveform, sample_rate)
      """
      if self.first_call:
          self.hparams.generator.remove_weight_norm()
          self.first_call = False
      with torch.no_grad():
          waveform = self.infer(
              spectrogram.unsqueeze(0).to(self.device)
          )
      return waveform.squeeze(0)
  
imports: import logging
  import torch
  from speechbrain.dataio.dataio import length_to_mask
  from speechbrain.inference.interfaces import Pretrained
label_desc: Use image node_id 4 for calling the HIFIGAN obj's underlying member method code with example usage: obj.decode_spectrogram(spectrogram) and returns: waveform