class_docstr: A ready-to-use inference wrapper for DiffWave as vocoder.
  The wrapper allows to perform generative tasks:
      locally-conditional generation: mel_spec -> waveform
  Arguments
  ---------
  hparams
      Hyperparameters (from HyperPyYAML)
class_docstr_tok: ["A","ready-to-use","inference","wrapper","for","DiffWave","as","vocoder",".","The","wrapper","allows","to","perform","generative","tasks",":","locally-conditional","generation",":","mel_spec","-",">","waveform","Arguments","--","--","--","--","-","hparams","Hyperparameters","(","from","HyperPyYAML",")"]
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 DiffWaveVocoder obj's underlying member method code with example usage: obj.mask_noise(waveform, mel_lens, hop_len) and returns: waveform