class_docstr: Base `encoder` class. Every new `encoder` model must inherit this.
  
  It defines common `encoder` specific functions.
class_docstr_tok: ["Base","`","encoder","`","class",".","Every","new","`","encoder","`","model","must","inherit","this",".","It","defines","common","`","encoder","`","specific","functions","."]
docstr: Generate embeddings for a batch of utterances
  x: 1xTxD
docstr_tok: ["Generate","embeddings","for","a","batch","of","utterances","x",":","1xTxD"]
code: def compute_embedding(
      self,
      x,
      num_frames=250,
      num_eval=10,
      return_mean=True,
      l2_norm=True,
  ):
      """
      Generate embeddings for a batch of utterances
      x: 1xTxD
      """
      # map to the waveform size
      if self.use_torch_spec:
          num_frames = num_frames * self.audio_config["hop_length"]
  
      max_len = x.shape[1]
  
      if max_len < num_frames:
          num_frames = max_len
  
      offsets = np.linspace(0, max_len - num_frames, num=num_eval)
  
      frames_batch = []
      for offset in offsets:
          offset = int(offset)
          end_offset = int(offset + num_frames)
          frames = x[:, offset:end_offset]
          frames_batch.append(frames)
  
      frames_batch = torch.cat(frames_batch, dim=0)
      embeddings = self.inference(frames_batch, l2_norm=l2_norm)
  
      if return_mean:
          embeddings = torch.mean(embeddings, dim=0, keepdim=True)
      return embeddings
  
file_path: TTS/TTS/encoder/models/base_encoder.py
imports: import numpy
  import torch
  import torchaudio
  from coqpit import Coqpit
  from torch import nn
  from TTS.encoder.losses import AngleProtoLoss, GE2ELoss, SoftmaxAngleProtoLoss
  from TTS.utils.generic_utils import set_init_dict
  from TTS.utils.io import load_fsspec
label_desc: Use image node_id 4 for calling the BaseEncoder obj's underlying member method code with example usage: obj.compute_embedding(x, num_frames, num_eval, return_mean, l2_norm) and returns: embeddings