code: def emb_computation_loop(split, set_loader, stat_file):
      """Computes the embeddings and saves the in a stat file"""
      # Extract embeddings (skip if already done)
      if not os.path.isfile(stat_file):
          embeddings = numpy.empty(
              shape=[0, params["emb_dim"]], dtype=numpy.float64
          )
          modelset = []
          segset = []
          with tqdm(set_loader, dynamic_ncols=True) as t:
              for batch in t:
                  ids = batch.id
                  wavs, lens = batch.sig
                  mod = [x for x in ids]
                  seg = [x for x in ids]
                  modelset = modelset + mod
                  segset = segset + seg
  
                  # Enrollment and test embeddings
                  embs = compute_embeddings(wavs, lens)
                  xv = embs.squeeze().cpu().numpy()
                  embeddings = numpy.concatenate(
                      (embeddings, xv), axis=0
                  )
  
          modelset = numpy.array(modelset, dtype="|O")
          segset = numpy.array(segset, dtype="|O")
  
          # Intialize variables for start, stop and stat0
          s = numpy.array([None] * embeddings.shape[0])
          b = numpy.array([[1.0]] * embeddings.shape[0])
  
          # Stat object (used to collect embeddings)
          stat_obj = StatObject_SB(
              modelset=modelset,
              segset=segset,
              start=s,
              stop=s,
              stat0=b,
              stat1=embeddings,
          )
          logger.info(f"Saving stat obj for {split}")
          stat_obj.save_stat_object(stat_file)
  
      else:
          logger.info(f"Skipping embedding Extraction for {split}")
          logger.info(
              f"Loading previously saved stat_object for {split}"
          )
  
          with open(stat_file, "rb") as input:
              stat_obj = pickle.load(input)
  
      return stat_obj
  
imports: import os
  import sys
  import torch
  import torchaudio
  import logging
  import speechbrain
  import numpy
  import pickle
  from tqdm.contrib import tqdm
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.metric_stats import EER, minDCF
  from speechbrain.processing.PLDA_LDA import StatObject_SB
  from speechbrain.processing.PLDA_LDA import Ndx
  from speechbrain.processing.PLDA_LDA import fast_PLDA_scoring
  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: emb_computation_loop(split, set_loader, stat_file) and returns: stat_obj