docstr: Computes an embedding for a single utterance. The utterance is divided in partial
  utterances and an embedding is computed for each. The complete utterance embedding is the
  L2-normed average embedding of the partial utterances.
  
  TODO: independent batched version of this function
  
  :param wav: a preprocessed utterance waveform as a numpy array of float32
  :param return_partials: if True, the partial embeddings will also be returned along with
  the wav slices corresponding to each partial utterance.
  :param rate: how many partial utterances should occur per second. Partial utterances must
  cover the span of the entire utterance, thus the rate should not be lower than the inverse
  of the duration of a partial utterance. By default, partial utterances are 1.6s long and
  the minimum rate is thus 0.625.
  :param min_coverage: when reaching the last partial utterance, it may or may not have
  enough frames. If at least <min_pad_coverage> of <partials_n_frames> are present,
  then the last partial utterance will be considered by zero-padding the audio. Otherwise,
  it will be discarded. If there aren't enough frames for one partial utterance,
  this parameter is ignored so that the function always returns at least one slice.
  :return: the embedding as a numpy array of float32 of shape (model_embedding_size,). If
  <return_partials> is True, the partial utterances as a numpy array of float32 of shape
  (n_partials, model_embedding_size) and the wav partials as a list of slices will also be
  returned.
docstr_tok: ["Computes","an","embedding","for","a","single","utterance",".","The","utterance","is","divided","in","partial","utterances","and","an","embedding","is","computed","for","each",".","The","complete","utterance","embedding","is","the","L2-normed","average","embedding","of","the","partial","utterances",".","TODO",":","independent","batched","version","of","this","function",":","param","wav",":","a","preprocessed","utterance","waveform","as","a","numpy","array","of","float32",":","param","return_partials",":","if","True",",","the","partial","embeddings","will","also","be","returned","along","with","the","wav","slices","corresponding","to","each","partial","utterance",".",":","param","rate",":","how","many","partial","utterances","should","occur","per","second",".","Partial","utterances","must","cover","the","span","of","the","entire","utterance",",","thus","the","rate","should","not","be","lower","than","the","inverse","of","the","duration","of","a","partial","utterance",".","By","default",",","partial","utterances","are","1.6s","long","and","the","minimum","rate","is","thus","0.625.",":","param","min_coverage",":","when","reaching","the","last","partial","utterance",",","it","may","or","may","not","have","enough","frames",".","If","at","least","<","min_pad_coverage",">","of","<","partials_n_frames",">","are","present",",","then","the","last","partial","utterance","will","be","considered","by","zero-padding","the","audio",".","Otherwise",",","it","will","be","discarded",".","If","there","are","n't","enough","frames","for","one","partial","utterance",",","this","parameter","is","ignored","so","that","the","function","always","returns","at","least","one","slice",".",":","return",":","the","embedding","as","a","numpy","array","of","float32","of","shape","(","model_embedding_size",",",")",".","If","<","return_partials",">","is","True",",","the","partial","utterances","as","a","numpy","array","of","float32","of","shape","(","n_partials",",","model_embedding_size",")","and","the","wav","partials","as","a","list","of","slices","will","also","be","returned","."]
code: def embed_utterance(
      self,
      wav: np.ndarray,
      return_partials=False,
      rate=1.3,
      min_coverage=0.75,
  ):
      """
      Computes an embedding for a single utterance. The utterance is divided in partial
      utterances and an embedding is computed for each. The complete utterance embedding is the
      L2-normed average embedding of the partial utterances.
  
      TODO: independent batched version of this function
  
      :param wav: a preprocessed utterance waveform as a numpy array of float32
      :param return_partials: if True, the partial embeddings will also be returned along with
      the wav slices corresponding to each partial utterance.
      :param rate: how many partial utterances should occur per second. Partial utterances must
      cover the span of the entire utterance, thus the rate should not be lower than the inverse
      of the duration of a partial utterance. By default, partial utterances are 1.6s long and
      the minimum rate is thus 0.625.
      :param min_coverage: when reaching the last partial utterance, it may or may not have
      enough frames. If at least <min_pad_coverage> of <partials_n_frames> are present,
      then the last partial utterance will be considered by zero-padding the audio. Otherwise,
      it will be discarded. If there aren't enough frames for one partial utterance,
      this parameter is ignored so that the function always returns at least one slice.
      :return: the embedding as a numpy array of float32 of shape (model_embedding_size,). If
      <return_partials> is True, the partial utterances as a numpy array of float32 of shape
      (n_partials, model_embedding_size) and the wav partials as a list of slices will also be
      returned.
      """
      # Compute where to split the utterance into partials and pad the waveform with zeros if
      # the partial utterances cover a larger range.
      wav_slices, mel_slices = self.compute_partial_slices(
          len(wav), rate, min_coverage
      )
      max_wave_length = wav_slices[-1].stop
      if max_wave_length >= len(wav):
          wav = np.pad(wav, (0, max_wave_length - len(wav)), "constant")
  
      # Split the utterance into partials and forward them through the model
      mel = audio.wav_to_mel_spectrogram(wav)
      mels = np.array([mel[s] for s in mel_slices])
      with torch.no_grad():
          mels = torch.from_numpy(mels).to(self.device)
          partial_embeds = self(mels).cpu().numpy()
  
      # Compute the utterance embedding from the partial embeddings
      raw_embed = np.mean(partial_embeds, axis=0)
      embed = raw_embed / np.linalg.norm(raw_embed, 2)
  
      if return_partials:
          return embed, partial_embeds, wav_slices
      return embed
  
file_path: TTS/TTS/vc/modules/freevc/speaker_encoder/speaker_encoder.py
imports: from pathlib import Path
  from time import perf_counter
  from typing import List, Union
  import numpy
  import torch
  from torch import nn
  from TTS.utils.io import load_fsspec
  from TTS.vc.modules.freevc.speaker_encoder import audio
  from TTS.vc.modules.freevc.speaker_encoder.hparams import *
label_desc: Use image node_id 4 for calling the SpeakerEncoder obj's underlying member method code with example usage: obj.embed_utterance(wav, return_partials, rate, min_coverage) and returns: embed, embed,  partial_embeds,  wav_slices