code: def get_verification_scores(veri_test):
      """Computes positive and negative scores given the verification split."""
      scores = []
      positive_scores = []
      negative_scores = []
  
      save_file = os.path.join(params["output_folder"], "scores.txt")
      s_file = open(save_file, "w")
  
      # Cosine similarity initialization
      similarity = torch.nn.CosineSimilarity(dim=-1, eps=1e-6)
  
      # creating cohort for score normalization
      if "score_norm" in params:
          train_cohort = torch.stack(list(train_dict.values()))
  
      for i, line in enumerate(veri_test):
          # Reading verification file (enrol_file test_file label)
          lab_pair = int(
              line.split(" ")[0].rstrip().split(".")[0].strip()
          )
          enrol_id = line.split(" ")[1].rstrip().split(".")[0].strip()
          test_id = line.split(" ")[2].rstrip().split(".")[0].strip()
          enrol = enrol_dict[enrol_id]
          test = test_dict[test_id]
  
          if "score_norm" in params:
              # Getting norm stats for enrol impostors
              enrol_rep = enrol.repeat(train_cohort.shape[0], 1, 1)
              score_e_c = similarity(enrol_rep, train_cohort)
  
              if "cohort_size" in params:
                  score_e_c = torch.topk(
                      score_e_c, k=params["cohort_size"], dim=0
                  )[0]
  
              mean_e_c = torch.mean(score_e_c, dim=0)
              std_e_c = torch.std(score_e_c, dim=0)
  
              # Getting norm stats for test impostors
              test_rep = test.repeat(train_cohort.shape[0], 1, 1)
              score_t_c = similarity(test_rep, train_cohort)
  
              if "cohort_size" in params:
                  score_t_c = torch.topk(
                      score_t_c, k=params["cohort_size"], dim=0
                  )[0]
  
              mean_t_c = torch.mean(score_t_c, dim=0)
              std_t_c = torch.std(score_t_c, dim=0)
  
          # Compute the score for the given sentence
          score = similarity(enrol, test)[0]
  
          # Perform score normalization
          if "score_norm" in params:
              if params["score_norm"] == "z-norm":
                  score = (score - mean_e_c) / std_e_c
              elif params["score_norm"] == "t-norm":
                  score = (score - mean_t_c) / std_t_c
              elif params["score_norm"] == "s-norm":
                  score_e = (score - mean_e_c) / std_e_c
                  score_t = (score - mean_t_c) / std_t_c
                  score = 0.5 * (score_e + score_t)
  
          # write score file
          s_file.write(
              "%s %s %i %f\n" % (enrol_id, test_id, lab_pair, score)
          )
          scores.append(score)
  
          if lab_pair == 1:
              positive_scores.append(score)
          else:
              negative_scores.append(score)
  
      s_file.close()
      return positive_scores, negative_scores
  
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 3 for calling a global function with example usage: get_verification_scores(veri_test) and returns: positive_scores,  negative_scores