class_docstr: Base `Embedding` Manager class. Every new `Embedding` manager must inherit this.
  It defines common `Embedding` manager specific functions.
  
  It expects embeddings files in the following format:
  
  ::
  
      {
          'audio_file_key':{
              'name': 'category_name',
              'embedding'[<embedding_values>]
          },
          ...
      }
  
  `audio_file_key` is a unique key to the audio file in the dataset. It can be the path to the file or any other unique key.
  `embedding` is the embedding vector of the audio file.
  `name` can be name of the speaker of the audio file.
class_docstr_tok: ["Base","`","Embedding","`","Manager","class",".","Every","new","`","Embedding","`","manager","must","inherit","this",".","It","defines","common","`","Embedding","`","manager","specific","functions",".","It","expects","embeddings","files","in","the","following","format",":",":",":","{","'audio_file_key","'",":","{","'name","'",":","'category_name","'",",","'embedding","'","[","<","embedding_values",">","]","}",",","...","}","`","audio_file_key","`","is","a","unique","key","to","the","audio","file","in","the","dataset",".","It","can","be","the","path","to","the","file","or","any","other","unique","key",".","`","embedding","`","is","the","embedding","vector","of","the","audio","file",".","`","name","`","can","be","name","of","the","speaker","of","the","audio","file","."]
docstr: Get mean embedding of a idx.
  
  Args:
      idx (str): Target name.
      num_samples (int, optional): Number of samples to be averaged. Defaults to None.
      randomize (bool, optional): Pick random `num_samples` of embeddings. Defaults to False.
  
  Returns:
      np.ndarray: Mean embedding.
docstr_tok: ["Get","mean","embedding","of","a","idx",".","Args",":","idx","(","str",")",":","Target","name",".","num_samples","(","int",",","optional",")",":","Number","of","samples","to","be","averaged",".","Defaults","to","None",".","randomize","(","bool",",","optional",")",":","Pick","random","`","num_samples","`","of","embeddings",".","Defaults","to","False",".","Returns",":","np.ndarray",":","Mean","embedding","."]
code: def get_mean_embedding(
      self, idx: str, num_samples: int = None, randomize: bool = False
  ) -> np.ndarray:
      """Get mean embedding of a idx.
  
      Args:
          idx (str): Target name.
          num_samples (int, optional): Number of samples to be averaged. Defaults to None.
          randomize (bool, optional): Pick random `num_samples` of embeddings. Defaults to False.
  
      Returns:
          np.ndarray: Mean embedding.
      """
      embeddings = self.get_embeddings_by_name(idx)
      if num_samples is None:
          embeddings = np.stack(embeddings).mean(0)
      else:
          assert (
              len(embeddings) >= num_samples
          ), f" [!] {idx} has number of samples < {num_samples}"
          if randomize:
              embeddings = np.stack(
                  random.choices(embeddings, k=num_samples)
              ).mean(0)
          else:
              embeddings = np.stack(embeddings[:num_samples]).mean(0)
      return embeddings
  
imports: import json
  import random
  from typing import Any, Dict, List, Tuple, Union
  import fsspec
  import numpy
  import torch
  from TTS.config import load_config
  from TTS.encoder.utils.generic_utils import setup_encoder_model
  from TTS.utils.audio import AudioProcessor
label_desc: Use image node_id 13 for calling the EmbeddingManager obj's underlying member method code with example usage: obj.get_mean_embedding(idx, num_samples, randomize) and returns: embeddings