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: Convert frame-level diarization target variable into segment-level target variable. Since the granularity is reduced
  from frame level (10ms) to segment level (100ms~500ms), we need a threshold value, `soft_label_thres`, which determines
  the label of each segment based on the overlap between a segment range (start and end time) and the frame-level target variable.
  
  Args:
      uniq_id (str):
          Unique file ID that refers to an input audio file and corresponding RTTM (Annotation) file.
      sample:
          `DiarizationSpeechLabel` instance containing sample information such as audio filepath and RTTM filepath.
      fr_level_target (torch.tensor):
          Tensor containing label for each feature-level frame.
  
  Returns:
      seg_target (torch.tensor):
          Tensor containing binary speaker labels for base-scale segments.
      base_clus_label (torch.tensor):
          Representative speaker label for each segment. This variable only has one speaker label for each base-scale segment.
          -1 means that there is no corresponding speaker in the target_spks tuple.
docstr_tok: ["Convert","frame-level","diarization","target","variable","into","segment-level","target","variable",".","Since","the","granularity","is","reduced","from","frame","level","(","10ms",")","to","segment","level","(","100ms~500ms",")",",","we","need","a","threshold","value",",","`","soft_label_thres","`",",","which","determines","the","label","of","each","segment","based","on","the","overlap","between","a","segment","range","(","start","and","end","time",")","and","the","frame-level","target","variable",".","Args",":","uniq_id","(","str",")",":","Unique","file","ID","that","refers","to","an","input","audio","file","and","corresponding","RTTM","(","Annotation",")","file",".","sample",":","`","DiarizationSpeechLabel","`","instance","containing","sample","information","such","as","audio","filepath","and","RTTM","filepath",".","fr_level_target","(","torch.tensor",")",":","Tensor","containing","label","for","each","feature-level","frame",".","Returns",":","seg_target","(","torch.tensor",")",":","Tensor","containing","binary","speaker","labels","for","base-scale","segments",".","base_clus_label","(","torch.tensor",")",":","Representative","speaker","label","for","each","segment",".","This","variable","only","has","one","speaker","label","for","each","base-scale","segment",".","-1","means","that","there","is","no","corresponding","speaker","in","the","target_spks","tuple","."]
code: def get_diar_target_labels(self, uniq_id, sample, fr_level_target):
      """
      Convert frame-level diarization target variable into segment-level target variable. Since the granularity is reduced
      from frame level (10ms) to segment level (100ms~500ms), we need a threshold value, `soft_label_thres`, which determines
      the label of each segment based on the overlap between a segment range (start and end time) and the frame-level target variable.
  
      Args:
          uniq_id (str):
              Unique file ID that refers to an input audio file and corresponding RTTM (Annotation) file.
          sample:
              `DiarizationSpeechLabel` instance containing sample information such as audio filepath and RTTM filepath.
          fr_level_target (torch.tensor):
              Tensor containing label for each feature-level frame.
  
      Returns:
          seg_target (torch.tensor):
              Tensor containing binary speaker labels for base-scale segments.
          base_clus_label (torch.tensor):
              Representative speaker label for each segment. This variable only has one speaker label for each base-scale segment.
              -1 means that there is no corresponding speaker in the target_spks tuple.
      """
      seg_target_list, base_clus_label = [], []
      self.scale_n = len(
          self.multiscale_timestamp_dict[uniq_id]["scale_dict"]
      )
      subseg_time_stamp_list = self.multiscale_timestamp_dict[uniq_id][
          "scale_dict"
      ][self.scale_n - 1]["time_stamps"]
      for seg_stt, seg_end in subseg_time_stamp_list:
          seg_stt_fr, seg_end_fr = int(
              seg_stt * self.frame_per_sec
          ), int(seg_end * self.frame_per_sec)
          soft_label_vec_sess = torch.sum(
              fr_level_target[seg_stt_fr:seg_end_fr, :], axis=0
          ) / (seg_end_fr - seg_stt_fr)
          label_int_sess = torch.argmax(soft_label_vec_sess)
          soft_label_vec = soft_label_vec_sess.unsqueeze(0)[
              :, sample.target_spks
          ].squeeze()
          if (
              label_int_sess in sample.target_spks
              and torch.sum(soft_label_vec_sess) > 0
          ):
              label_int = sample.target_spks.index(label_int_sess)
          else:
              label_int = -1
          label_vec = (soft_label_vec > self.soft_label_thres).float()
          seg_target_list.append(label_vec.detach())
          base_clus_label.append(label_int)
      seg_target = torch.stack(seg_target_list)
      base_clus_label = torch.tensor(base_clus_label)
      return seg_target, base_clus_label
  
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 the _AudioMSDDTrainDataset obj's underlying member method code with example usage: obj.get_diar_target_labels(uniq_id, sample, fr_level_target) and returns: seg_target,  base_clus_label