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: Mask the noise caused by padding during batch inference
  Arguments
  ---------
  wavform: torch.tensor
      Batch of generated waveforms [batch, 1, 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
      same value as in the .yaml file
  Returns
  -------
  waveform: torch.tensor
      Batch of waveforms without padded noise [batch, 1, time]
docstr_tok: ["Mask","the","noise","caused","by","padding","during","batch","inference","Arguments","--","--","--","--","-","wavform",":","torch.tensor","Batch","of","generated","waveforms","[","batch",",","1",",","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","same","value","as","in","the",".yaml","file","Returns","--","--","--","-","waveform",":","torch.tensor","Batch","of","waveforms","without","padded","noise","[","batch",",","1",",","time","]"]
code: def mask_noise(self, waveform, mel_lens, hop_len):
      """Mask the noise caused by padding during batch inference
      Arguments
      ---------
      wavform: torch.tensor
          Batch of generated waveforms [batch, 1, 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
          same value as in the .yaml file
      Returns
      -------
      waveform: torch.tensor
          Batch of waveforms without padded noise [batch, 1, time]
      """
      waveform = waveform.squeeze(1)
      # the correct audio length should be hop_len * mel_len
      mask = length_to_mask(
          mel_lens * hop_len, waveform.shape[1], device=waveform.device
      ).bool()
      waveform.masked_fill_(~mask, 0.0)
      return waveform.unsqueeze(1)
  
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 3 for calling the HIFIGAN obj's underlying member method code with example usage: obj.mask_noise(waveform, mel_lens, hop_len) and returns: waveform