code: def _msdd_infer_collate_fn(self, batch):
      """
      Collate batch of feats (speaker embeddings), feature lengths, target label sequences and cluster-average embeddings.
  
      Args:
          batch (tuple):
              Batch tuple containing feats, feats_len, targets and ms_avg_embs.
      Returns:
          feats (torch.tensor):
              Collated speaker embedding with unified length.
          feats_len (torch.tensor):
              The actual length of each embedding sequence without zero padding.
          targets (torch.tensor):
              Groundtruth Speaker label for the given input embedding sequence.
          ms_avg_embs (torch.tensor):
              Cluster-average speaker embedding vectors.
      """
  
      packed_batch = list(zip(*batch))
      feats, feats_len, targets, ms_avg_embs = packed_batch
      feats_list, flen_list, targets_list, ms_avg_embs_list = (
          [],
          [],
          [],
          [],
      )
      max_audio_len = max(feats_len)
      max_target_len = max([x.shape[0] for x in targets])
  
      for feature, feat_len, target, ivector in batch:
          flen_list.append(feat_len)
          ms_avg_embs_list.append(ivector)
          if feat_len < max_audio_len:
              pad_a = (0, 0, 0, 0, 0, max_audio_len - feat_len)
              pad_t = (0, 0, 0, max_target_len - target.shape[0])
              padded_feature = torch.nn.functional.pad(feature, pad_a)
              padded_target = torch.nn.functional.pad(target, pad_t)
              feats_list.append(padded_feature)
              targets_list.append(padded_target)
          else:
              targets_list.append(target.clone().detach())
              feats_list.append(feature.clone().detach())
  
      feats = torch.stack(feats_list)
      feats_len = torch.tensor(flen_list)
      targets = torch.stack(targets_list)
      ms_avg_embs = torch.stack(ms_avg_embs_list)
      return feats, feats_len, targets, ms_avg_embs
  
imports: import os
  from collections import OrderedDict
  from statistics import mode
  from typing import Dict, Optional
  import torch
  from nemo.collections.asr.parts.utils.offline_clustering import get_argmin_mat
  from nemo.collections.asr.parts.utils.speaker_utils import convert_rttm_line, prepare_split_data
  from nemo.collections.common.parts.preprocessing.collections import DiarizationSpeechLabel
  from nemo.core.classes import Dataset
  from nemo.core.neural_types import AudioSignal, EncodedRepresentation, LengthsType, NeuralType, ProbsType
label_desc: Use image node_id 5 for calling a global function with example usage: _msdd_infer_collate_fn(batch) and returns: feats,  feats_len,  targets,  ms_avg_embs