code: def patch_noise(
      image: tf.Tensor,
      gamma: tf.Tensor,
      patch_gamma: tf.Tensor,
      rng: int,
      denoise_configs: ml_collections.ConfigDict,
      dtype: tf.DType = tf.float32,
  ) -> Tuple[tf.Tensor, tf.Tensor, Tuple[tf.Tensor, tf.Tensor]]:
      """Add non uniform gaussian noise to the given image.
  
      Args:
        image: A single image,must be in 0-1 range.
        gamma: Controls the amount of noise in the background
        patch_gamma: Controls the amount of noise within the patches
        rng: Seed for sampling the noise.
        denoise_configs: Configurations for the denoising process.
        dtype: Data type of the image.
  
      Returns:
        The corrupted image and the noise.
      """
      noised_image_background, noise_background = add_gaussian_noise(
          image, gamma, False, rng, denoise_configs, dtype
      )
      noised_image_patch, noise_patch = add_gaussian_noise(
          image, patch_gamma, False, rng, denoise_configs, dtype
      )
      mask = get_mask(image, denoise_configs, dtype)
      noised_image = (noised_image_patch * mask) + (
          noised_image_background * (1 - mask)
      )
      noise = (noise_patch * mask) + (noise_background * (1 - mask))
  
      return noised_image, noise, (mask, patch_gamma)
  
file_path: scenic/scenic/projects/robust_segvit/datasets/denoise_utils.py
imports: from typing import Tuple, Optional
  from absl import logging
  import ml_collections
  import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: patch_noise(image, gamma, patch_gamma, rng, denoise_configs, dtype) and returns: noised_image,  noise,  mask,  patch_gamma