class_docstr: Dataset class that loads a json file containing paths to audio files,
  RTTM files and number of speakers. This Dataset class is designed for
  training or fine-tuning speaker embedding extractor and diarization decoder
  at the same time.
  
  Example:
  {"audio_filepath": "/path/to/audio_0.wav", "num_speakers": 2,
  "rttm_filepath": "/path/to/diar_label_0.rttm}
  ...
  {"audio_filepath": "/path/to/audio_n.wav", "num_speakers": 2,
  "rttm_filepath": "/path/to/diar_label_n.rttm}
  
  Args:
      manifest_filepath (str):
          Path to input manifest json files.
      multiscale_args_dict (dict):
          Dictionary containing the parameters for multiscale segmentation and clustering.
      emb_dir (str):
          Path to a temporary folder where segmentation information for embedding extraction is saved.
      soft_label_thres (float):
          Threshold that determines the label of each segment based on RTTM file information.
      featurizer:
          Featurizer instance for generating features from the raw waveform.
      window_stride (float):
          Window stride for acoustic feature. This value is used for calculating the numbers of feature-level frames.
      emb_batch_size (int):
          Number of embedding vectors that are trained with attached computational graphs.
      pairwise_infer (bool):
          This variable should be True if dataloader is created for an inference task.
      random_flip (bool):
          If True, the two labels and input signals are randomly flipped per every epoch while training.
docstr: Assign the generated speaker labels from the base scale (the finest scale) to the longer scales.
  This process is needed to get the cluster labels for each scale. The cluster labels are needed to
  calculate the cluster-average speaker embedding for each scale.
  
  Args:
      uniq_id (str):
          Unique sample ID for training.
      base_scale_clus_label (torch.tensor):
          Tensor variable containing the speaker labels for the base-scale segments.
  
  Returns:
      per_scale_clus_label (torch.tensor):
          Tensor variable containing the speaker labels for each segment in each scale.
          Note that the total length of the speaker label sequence differs over scale since
          each scale has a different number of segments for the same session.
  
      scale_mapping (torch.tensor):
          Matrix containing the segment indices of each scale. scale_mapping is necessary for reshaping the
          multiscale embeddings to form an input matrix for the MSDD model.
docstr_tok: ["Assign","the","generated","speaker","labels","from","the","base","scale","(","the","finest","scale",")","to","the","longer","scales",".","This","process","is","needed","to","get","the","cluster","labels","for","each","scale",".","The","cluster","labels","are","needed","to","calculate","the","cluster-average","speaker","embedding","for","each","scale",".","Args",":","uniq_id","(","str",")",":","Unique","sample","ID","for","training",".","base_scale_clus_label","(","torch.tensor",")",":","Tensor","variable","containing","the","speaker","labels","for","the","base-scale","segments",".","Returns",":","per_scale_clus_label","(","torch.tensor",")",":","Tensor","variable","containing","the","speaker","labels","for","each","segment","in","each","scale",".","Note","that","the","total","length","of","the","speaker","label","sequence","differs","over","scale","since","each","scale","has","a","different","number","of","segments","for","the","same","session",".","scale_mapping","(","torch.tensor",")",":","Matrix","containing","the","segment","indices","of","each","scale",".","scale_mapping","is","necessary","for","reshaping","the","multiscale","embeddings","to","form","an","input","matrix","for","the","MSDD","model","."]
code: def assign_labels_to_longer_segs(
      self, uniq_id, base_scale_clus_label
  ):
      """
      Assign the generated speaker labels from the base scale (the finest scale) to the longer scales.
      This process is needed to get the cluster labels for each scale. The cluster labels are needed to
      calculate the cluster-average speaker embedding for each scale.
  
      Args:
          uniq_id (str):
              Unique sample ID for training.
          base_scale_clus_label (torch.tensor):
              Tensor variable containing the speaker labels for the base-scale segments.
  
      Returns:
          per_scale_clus_label (torch.tensor):
              Tensor variable containing the speaker labels for each segment in each scale.
              Note that the total length of the speaker label sequence differs over scale since
              each scale has a different number of segments for the same session.
  
          scale_mapping (torch.tensor):
              Matrix containing the segment indices of each scale. scale_mapping is necessary for reshaping the
              multiscale embeddings to form an input matrix for the MSDD model.
      """
      per_scale_clus_label = []
      self.scale_n = len(
          self.multiscale_timestamp_dict[uniq_id]["scale_dict"]
      )
      uniq_scale_mapping = get_scale_mapping_list(
          self.multiscale_timestamp_dict[uniq_id]
      )
      for scale_index in range(self.scale_n):
          new_clus_label = []
          scale_seq_len = len(
              self.multiscale_timestamp_dict[uniq_id]["scale_dict"][
                  scale_index
              ]["time_stamps"]
          )
          for seg_idx in range(scale_seq_len):
              if seg_idx in uniq_scale_mapping[scale_index]:
                  seg_clus_label = mode(
                      base_scale_clus_label[
                          uniq_scale_mapping[scale_index] == seg_idx
                      ]
                  )
              else:
                  seg_clus_label = (
                      0
                      if len(new_clus_label) == 0
                      else new_clus_label[-1]
                  )
              new_clus_label.append(seg_clus_label)
          per_scale_clus_label.extend(new_clus_label)
      per_scale_clus_label = torch.tensor(per_scale_clus_label)
      return per_scale_clus_label, uniq_scale_mapping
  
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 4 for calling the _AudioMSDDTrainDataset obj's underlying member method code with example usage: obj.assign_labels_to_longer_segs(uniq_id, base_scale_clus_label) and returns: per_scale_clus_label,  uniq_scale_mapping