code: def compute_embedding_loop(data_loader):
      """Computes the embeddings of all the waveforms specified in the
      dataloader.
      """
      embedding_dict = {}
  
      with torch.no_grad():
          for batch in tqdm(data_loader, dynamic_ncols=True):
              batch = batch.to(run_opts["device"])
              seg_ids = batch.id
              wavs, lens = batch.sig
  
              found = False
              for seg_id in seg_ids:
                  if seg_id not in embedding_dict:
                      found = True
              if not found:
                  continue
              wavs, lens = (
                  wavs.to(run_opts["device"]),
                  lens.to(run_opts["device"]),
              )
              emb = compute_embedding(wavs, lens).unsqueeze(1)
              for i, seg_id in enumerate(seg_ids):
                  embedding_dict[seg_id] = emb[i].detach().clone()
      return embedding_dict
  
file_path: speechbrain/recipes/VoxCeleb/SpeakerRec/speaker_verification_cosine.py
imports: import os
  import sys
  import torch
  import logging
  import torchaudio
  import speechbrain
  from tqdm.contrib import tqdm
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.metric_stats import EER, minDCF
  from speechbrain.utils.data_utils import download_file
  from speechbrain.utils.distributed import run_on_main
label_desc: Use image node_id 2 for calling a global function with example usage: compute_embedding_loop(data_loader) and returns: embedding_dict