code: def convert_ms_to_frame_number(batch, spectrogram_feature_name):
      """Convert start timestamps in microsec into the frame numbers."""
      word_start_timestamp = batch["mwp_start_timestamp"]
      word_end_timestamp = batch["mwp_end_timestamp"]
      wave_length = batch["mwp_wave_length"]
      spectrogram = batch[spectrogram_feature_name]
  
      start_idxs = tf.cast(
          tf.math.divide_no_nan(word_start_timestamp, wave_length)
          * tf.cast((tf.shape(spectrogram)[0] - 1), tf.float32),
          tf.int32,
      )
      end_idxs = tf.cast(
          tf.math.divide_no_nan(word_end_timestamp, wave_length)
          * tf.cast((tf.shape(spectrogram)[0] - 1), tf.float32),
          tf.int32,
      )
  
      batch["mwp_start_indices"] = start_idxs
      batch["mwp_end_indices"] = end_idxs
  
      del (
          batch["mwp_wave_length"],
          batch["mwp_start_timestamp"],
          batch["mwp_end_timestamp"],
      )
  
      return batch
  
imports: import functools
  from typing import Any, Dict, Optional, Sequence
  from absl import logging
  from dmvr import builders
  from dmvr import processors
  from dmvr import tokenizers
  import numpy
  from scenic.projects.mbt.datasets.dataset_utils import _decode_spectrogram
  from scenic.projects.mbt.datasets.dataset_utils import apply_specaugment
  import tensorflow
label_desc: Use image node_id 7 for calling a global function with example usage: convert_ms_to_frame_number(batch, spectrogram_feature_name) and returns: batch