code: def mask_word_with_white_noise(
      wave_tensor,
      snr,
      word_mask,
      word_sts,
      word_ets,
      sample_rate,
      extend_boundaries_ms,
  ):
      """Add word masking noise to the signal.
  
      Masks out wave signal that correspond to words indicated by word_mask. Each
      masked part is filled with Gaussian white noise whose power is determined by
      snr.
  
      Args:
        wave_tensor: Input tensor containing the raw wave signal.
        snr: The signal to noise ratio to determine the power of the white noise
          filled in the masked region. If None, the regions are zeroed out.
        word_mask: A boolean mask tensor where the words to mask are marked as True.
        word_sts: The start timestamps of the words.
        word_ets: The end timestamps of the words.
        sample_rate: The sample rate of the input wave signal.
        extend_boundaries_ms: If set, the start and end boundaries of each masking
          region in the signal is extended.
  
      Returns:
        Output signal with word masking noise injected.
      """
      if snr is not None and snr > 0.0:
          pos = tf.reduce_mean(tf.square(wave_tensor))
          nos = pos / snr
          # Deterministically create the noise using the input signal as the seeds.
          # The seeds are determined by the sums of the positive and negative signals.
          positive_sum = tf.cast(
              tf.reduce_sum(tf.maximum(wave_tensor, 0)), tf.int32
          )
          negative_sum = tf.cast(
              tf.reduce_sum(tf.maximum(-wave_tensor, 0)), tf.int32
          )
          noise = tf.random.stateless_normal(
              tf.shape(wave_tensor),
              seed=[positive_sum, negative_sum],
              stddev=tf.sqrt(nos),
              dtype=wave_tensor.dtype,
          )
      else:
          noise = 0
  
      target_word_sts = (
          tf.boolean_mask(word_sts, word_mask) - extend_boundaries_ms
      )
      target_word_ets = (
          tf.boolean_mask(word_ets, word_mask) + extend_boundaries_ms
      )
  
      timestamps = (
          tf.range(tf.shape(wave_tensor)[0], dtype=tf.float32)
          / sample_rate
      ) * 1000
      timestamps = tf.repeat(
          timestamps[None, :], tf.shape(target_word_sts)[0], 0
      )
  
      time_mask = tf.logical_and(
          tf.greater_equal(timestamps, target_word_sts[:, None]),
          tf.less_equal(timestamps, target_word_ets[:, None]),
      )
      time_mask = tf.cast(tf.reduce_any(time_mask, 0), tf.float32)
  
      noised_wave_tensor = (
          wave_tensor * (1 - time_mask) + noise * time_mask
      )
      return noised_wave_tensor, target_word_sts, target_word_ets
  
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 4 for calling a global function with example usage: mask_word_with_white_noise(wave_tensor, snr, word_mask, word_sts, word_ets, sample_rate, extend_boundaries_ms) and returns: noised_wave_tensor,  target_word_sts,  target_word_ets