class_docstr: A class that enables online (streaming) clustering based diarization.
  
  - The instance created from `OnlineClusteringDiarizer` sets aside a certain amount of memory
    to provide the upcoming inference with history information
  
  - There are two major modules involved: `OnlineSegmentor` and `OnlineSpeakerClustering`.
      OnlineSegmentor: Take the VAD-timestamps and generate segments for each scale
      OnlineSpeakerClustering: Update the entire speaker labels of the given online session
                               while updating the speaker labels of the streaming inputs.
  
  - The overall diarization process is done by calling `diarize_step` function.
    `diarize_step` function goes through the following steps:
      (1) Segmentation (`OnlineSegmentor` class)
      (2) Embedding extraction (`_extract_online_embeddings` function call)
      (3) Online speaker counting and speaker clustering (`OnlineClusteringDiarizer` class)
      (4) Label generation (`generate_cluster_labels` function call)
docstr: Calculate how many segments should be removed from memory (`memory_margin`) and
  save the necessary information.
  `keep_range` determines how many segments and their corresponding embedding, raw audio,
  timestamps in the memory of the online diarizer instance.
  
  Args:
      scale_idx (int):
          Scale index in integer type
docstr_tok: ["Calculate","how","many","segments","should","be","removed","from","memory","(","`","memory_margin","`",")","and","save","the","necessary","information",".","`","keep_range","`","determines","how","many","segments","and","their","corresponding","embedding",",","raw","audio",",","timestamps","in","the","memory","of","the","online","diarizer","instance",".","Args",":","scale_idx","(","int",")",":","Scale","index","in","integer","type"]
code: def _clear_memory(self, scale_idx: int):
      """
      Calculate how many segments should be removed from memory (`memory_margin`) and
      save the necessary information.
      `keep_range` determines how many segments and their corresponding embedding, raw audio,
      timestamps in the memory of the online diarizer instance.
  
      Args:
          scale_idx (int):
              Scale index in integer type
      """
      base_scale_shift = self.multiscale_args_dict["scale_dict"][
          self.base_scale_index
      ][1]
      self.memory_margin = int(
          (self.buffer_end - self.buffer_start) / base_scale_shift
      )
  
      scale_buffer_size = int(
          len(set(self.scale_mapping_dict[scale_idx].tolist()))
          / len(
              set(
                  self.scale_mapping_dict[
                      self.base_scale_index
                  ].tolist()
              )
          )
          * (self.history_n + self.current_n)
      )
      keep_range = scale_buffer_size + self.memory_margin
      self.emb_vectors[scale_idx] = self.emb_vectors[scale_idx][
          -keep_range:
      ]
      self.segment_raw_audio[scale_idx] = self.segment_raw_audio[
          scale_idx
      ][-keep_range:]
      self.segment_range_ts[scale_idx] = self.segment_range_ts[
          scale_idx
      ][-keep_range:]
      self.segment_indexes[scale_idx] = self.segment_indexes[scale_idx][
          -keep_range:
      ]
  
imports: import os
  import time
  from copy import deepcopy
  from typing import Dict
  import torch
  from omegaconf import DictConfig
  from nemo.collections.asr.models import ClusteringDiarizer
  from nemo.collections.asr.parts.utils.offline_clustering import get_scale_interpolated_embs, split_input_data
  from nemo.collections.asr.parts.utils.online_clustering import OnlineSpeakerClustering
  from nemo.collections.asr.parts.utils.speaker_utils import OnlineSegmentor, audio_rttm_map, generate_cluster_labels, get_embs_and_timestamps
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 10 for calling the OnlineClusteringDiarizer obj's underlying member method code with example usage: obj._clear_memory(scale_idx) without return types