class_docstr: Test SpeakerManager for loading embedding files and computing d_vectors from waveforms
class_docstr_tok: ["Test","SpeakerManager","for","loading","embedding","files","and","computing","d_vectors","from","waveforms"]
code: def test_dvector_file_processing(self):
      manager = SpeakerManager(d_vectors_file_path=d_vectors_file_path)
      self.assertEqual(manager.num_speakers, 1)
      self.assertEqual(manager.embedding_dim, 256)
      manager = SpeakerManager(
          d_vectors_file_path=d_vectors_file_pth_path
      )
      self.assertEqual(manager.num_speakers, 1)
      self.assertEqual(manager.embedding_dim, 256)
      d_vector = manager.get_embedding_by_clip(manager.clip_ids[0])
      assert len(d_vector) == 256
      d_vectors = manager.get_embeddings_by_name(
          manager.speaker_names[0]
      )
      assert len(d_vectors[0]) == 256
      d_vector1 = manager.get_mean_embedding(
          manager.speaker_names[0], num_samples=2, randomize=True
      )
      assert len(d_vector1) == 256
      d_vector2 = manager.get_mean_embedding(
          manager.speaker_names[0], num_samples=2, randomize=False
      )
      assert len(d_vector2) == 256
      assert np.sum(np.array(d_vector1) - np.array(d_vector2)) != 0
  
file_path: TTS/tests/aux_tests/test_speaker_manager.py
imports: import os
  import unittest
  import numpy
  import torch
  from trainer.io import save_checkpoint
  from tests import get_tests_input_path
  from TTS.config import load_config
  from TTS.encoder.utils.generic_utils import setup_encoder_model
  from TTS.tts.utils.speakers import SpeakerManager
  from TTS.utils.audio import AudioProcessor
label_desc: Use image node_id 2 for calling the SpeakerManagerTest obj's underlying member method code with example usage: obj.test_dvector_file_processing() without return types