docstr: Computes where to split an utterance waveform and its corresponding mel spectrogram to
  obtain partial utterances of <partials_n_frames> each. Both the waveform and the
  mel spectrogram slices are returned, so as to make each partial utterance waveform
  correspond to its spectrogram.
  
  The returned ranges may be indexing further than the length of the waveform. It is
  recommended that you pad the waveform with zeros up to wav_slices[-1].stop.
  
  :param n_samples: the number of samples in the waveform
  :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 waveform slices and mel spectrogram slices as lists of array slices. Index
  respectively the waveform and the mel spectrogram with these slices to obtain the partial
  utterances.
docstr_tok: ["Computes","where","to","split","an","utterance","waveform","and","its","corresponding","mel","spectrogram","to","obtain","partial","utterances","of","<","partials_n_frames",">","each",".","Both","the","waveform","and","the","mel","spectrogram","slices","are","returned",",","so","as","to","make","each","partial","utterance","waveform","correspond","to","its","spectrogram",".","The","returned","ranges","may","be","indexing","further","than","the","length","of","the","waveform",".","It","is","recommended","that","you","pad","the","waveform","with","zeros","up","to","wav_slices","[","-1","]",".stop",".",":","param","n_samples",":","the","number","of","samples","in","the","waveform",":","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","waveform","slices","and","mel","spectrogram","slices","as","lists","of","array","slices",".","Index","respectively","the","waveform","and","the","mel","spectrogram","with","these","slices","to","obtain","the","partial","utterances","."]
code: def compute_partial_slices(n_samples: int, rate, min_coverage):
      """
      Computes where to split an utterance waveform and its corresponding mel spectrogram to
      obtain partial utterances of <partials_n_frames> each. Both the waveform and the
      mel spectrogram slices are returned, so as to make each partial utterance waveform
      correspond to its spectrogram.
  
      The returned ranges may be indexing further than the length of the waveform. It is
      recommended that you pad the waveform with zeros up to wav_slices[-1].stop.
  
      :param n_samples: the number of samples in the waveform
      :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 waveform slices and mel spectrogram slices as lists of array slices. Index
      respectively the waveform and the mel spectrogram with these slices to obtain the partial
      utterances.
      """
      assert 0 < min_coverage <= 1
  
      # Compute how many frames separate two partial utterances
      samples_per_frame = int((sampling_rate * mel_window_step / 1000))
      n_frames = int(np.ceil((n_samples + 1) / samples_per_frame))
      frame_step = int(
          np.round((sampling_rate / rate) / samples_per_frame)
      )
      assert 0 < frame_step, "The rate is too high"
      assert (
          frame_step <= partials_n_frames
      ), "The rate is too low, it should be %f at least" % (
          sampling_rate / (samples_per_frame * partials_n_frames)
      )
  
      # Compute the slices
      wav_slices, mel_slices = [], []
      steps = max(1, n_frames - partials_n_frames + frame_step + 1)
      for i in range(0, steps, frame_step):
          mel_range = np.array([i, i + partials_n_frames])
          wav_range = mel_range * samples_per_frame
          mel_slices.append(slice(*mel_range))
          wav_slices.append(slice(*wav_range))
  
      # Evaluate whether extra padding is warranted or not
      last_wav_range = wav_slices[-1]
      coverage = (n_samples - last_wav_range.start) / (
          last_wav_range.stop - last_wav_range.start
      )
      if coverage < min_coverage and len(mel_slices) > 1:
          mel_slices = mel_slices[:-1]
          wav_slices = wav_slices[:-1]
  
      return wav_slices, mel_slices
  
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 3 for calling the SpeakerEncoder obj's underlying member method code with example usage: obj.compute_partial_slices(n_samples, rate, min_coverage) and returns: wav_slices,  mel_slices