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 batch of mel-spectrograms
  Arguments
  ---------
  spectrogram: torch.Tensor
      Batch of mel-spectrograms [batch, mels, time]
  mel_lens: torch.tensor
      A list of lengths of mel-spectrograms for the batch
      Can be obtained from the output of Tacotron/FastSpeech
  hop_len: int
      hop length used for mel-spectrogram extraction
      should be the same value as in the .yaml file
  Returns
  -------
  waveforms: torch.Tensor
      Batch of mel-waveforms [batch, 1, time]
docstr_tok: ["Computes","waveforms","from","a","batch","of","mel-spectrograms","Arguments","--","--","--","--","-","spectrogram",":","torch.Tensor","Batch","of","mel-spectrograms","[","batch",",","mels",",","time","]","mel_lens",":","torch.tensor","A","list","of","lengths","of","mel-spectrograms","for","the","batch","Can","be","obtained","from","the","output","of","Tacotron\/FastSpeech","hop_len",":","int","hop","length","used","for","mel-spectrogram","extraction","should","be","the","same","value","as","in","the",".yaml","file","Returns","--","--","--","-","waveforms",":","torch.Tensor","Batch","of","mel-waveforms","[","batch",",","1",",","time","]"]
code: def decode_batch(self, spectrogram, mel_lens=None, hop_len=None):
      """Computes waveforms from a batch of mel-spectrograms
      Arguments
      ---------
      spectrogram: torch.Tensor
          Batch of mel-spectrograms [batch, mels, time]
      mel_lens: torch.tensor
          A list of lengths of mel-spectrograms for the batch
          Can be obtained from the output of Tacotron/FastSpeech
      hop_len: int
          hop length used for mel-spectrogram extraction
          should be the same value as in the .yaml file
      Returns
      -------
      waveforms: torch.Tensor
          Batch of mel-waveforms [batch, 1, time]
      """
      # Prepare for inference by removing the weight norm
      if self.first_call:
          self.hparams.generator.remove_weight_norm()
          self.first_call = False
      with torch.no_grad():
          waveform = self.infer(spectrogram.to(self.device))
  
      # Mask the noise caused by padding during batch inference
      if mel_lens is not None and hop_len is not None:
          waveform = self.mask_noise(waveform, mel_lens, hop_len)
  
      return waveform
  
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 2 for calling the HIFIGAN obj's underlying member method code with example usage: obj.decode_batch(spectrogram, mel_lens, hop_len) and returns: waveform