class_docstr: A MelSpectrogramEncoder class created for the Zero-Shot Multi-Speaker TTS models.
  
  This is for speaker encoder models using the PyTorch MelSpectrogram transform for compatibility with the
  current TTS pipeline.
  
  This class can be used to encode a single waveform, a single mel-spectrogram, or a batch of mel-spectrograms.
  ```
  
  Example
  -------
  >>> import torchaudio
  >>> from speechbrain.inference.encoders import MelSpectrogramEncoder
  >>> # Model is downloaded from the speechbrain HuggingFace repo
  >>> tmpdir = getfixture("tmpdir")
  >>> encoder = MelSpectrogramEncoder.from_hparams(
  ...     source="speechbrain/tts-ecapa-voxceleb",
  ...     savedir=tmpdir,
  ... ) # doctest: +SKIP
  
  >>> # Compute embedding from a waveform (sample_rate must match the sample rate of the encoder)
  >>> signal, fs = torchaudio.load("tests/samples/single-mic/example1.wav") # doctest: +SKIP
  >>> spk_emb = encoder.encode_waveform(signal) # doctest: +SKIP
  
  >>> # Compute embedding from a mel-spectrogram (sample_rate must match the sample rate of the ecoder)
  >>> mel_spec = encoder.mel_spectogram(audio=signal) # doctest: +SKIP
  >>> spk_emb = encoder.encode_mel_spectrogram(mel_spec) # doctest: +SKIP
  
  >>> # Compute embeddings for a batch of mel-spectrograms
  >>> spk_embs = encoder.encode_mel_spectrogram_batch(mel_spec) # doctest: +SKIP
class_docstr_tok: ["A","MelSpectrogramEncoder","class","created","for","the","Zero-Shot","Multi-Speaker","TTS","models",".","This","is","for","speaker","encoder","models","using","the","PyTorch","MelSpectrogram","transform","for","compatibility","with","the","current","TTS","pipeline",".","This","class","can","be","used","to","encode","a","single","waveform",",","a","single","mel-spectrogram",",","or","a","batch","of","mel-spectrograms",".","``","`","Example","--","--","--","-",">",">",">","import","torchaudio",">",">",">","from","speechbrain.inference.encoders","import","MelSpectrogramEncoder",">",">",">","#","Model","is","downloaded","from","the","speechbrain","HuggingFace","repo",">",">",">","tmpdir","=","getfixture","(","``","tmpdir","''",")",">",">",">","encoder","=","MelSpectrogramEncoder.from_hparams","(","...","source=","''","speechbrain\/tts-ecapa-voxceleb","''",",","...","savedir=tmpdir",",","...",")","#","doctest",":","+SKIP",">",">",">","#","Compute","embedding","from","a","waveform","(","sample_rate","must","match","the","sample","rate","of","the","encoder",")",">",">",">","signal",",","fs","=","torchaudio.load","(","``","tests\/samples\/single-mic\/example1.wav","''",")","#","doctest",":","+SKIP",">",">",">","spk_emb","=","encoder.encode_waveform","(","signal",")","#","doctest",":","+SKIP",">",">",">","#","Compute","embedding","from","a","mel-spectrogram","(","sample_rate","must","match","the","sample","rate","of","the","ecoder",")",">",">",">","mel_spec","=","encoder.mel_spectogram","(","audio=signal",")","#","doctest",":","+SKIP",">",">",">","spk_emb","=","encoder.encode_mel_spectrogram","(","mel_spec",")","#","doctest",":","+SKIP",">",">",">","#","Compute","embeddings","for","a","batch","of","mel-spectrograms",">",">",">","spk_embs","=","encoder.encode_mel_spectrogram_batch","(","mel_spec",")","#","doctest",":","+SKIP"]
docstr: Runs the encoder
docstr_tok: ["Runs","the","encoder"]
code: def __forward(self, mel_specs, lens):
      """Runs the encoder"""
      return self.encode_batch(mel_specs, lens)
  
file_path: speechbrain/speechbrain/inference/encoders.py
imports: import torch
  from speechbrain.inference.interfaces import Pretrained
label_desc: Use image node_id 7 for calling the MelSpectrogramEncoder obj's underlying member method code with example usage: obj.__forward(mel_specs, lens) and returns: self