code: def get_mask(
      image: tf.Tensor,
      denoise_configs: ml_collections.ConfigDict,
      dtype: tf.DType = tf.float32,
  ) -> tf.Tensor:
      """Generates random bounding box coordinates and turns them into a mask.
  
      Args:
        image: The image for which the bounding boxes are being generated.
        denoise_configs: Configurations for the denoising process.
        dtype: Data type of the image.
  
      Returns:
        The mask for the cut out regions.
      """
      h, w, _ = image.shape
      bboxes = []
      for _ in range(denoise_configs.n_bboxes):
          bboxes.append(
              tf.image.sample_distorted_bounding_box(
                  image_size=image.shape,
                  bounding_boxes=tf.zeros((0, 0, 4)),
                  min_object_covered=0.0,
                  area_range=denoise_configs.area_range,
                  aspect_ratio_range=denoise_configs.aspect_ratio_range,
                  use_image_if_no_bounding_boxes=True,
              )[2]
          )
      bboxes = tf.stack(bboxes)
  
      x, y = tf.meshgrid(
          tf.range(w, dtype=tf.int32), tf.range(h, dtype=tf.int32)
      )
      y_min = tf.cast(bboxes[..., 0] * h, dtype=x.dtype)
      x_min = tf.cast(bboxes[..., 1] * w, dtype=x.dtype)
      y_max = tf.cast(bboxes[..., 2] * h, dtype=x.dtype)
      x_max = tf.cast(bboxes[..., 3] * w, dtype=x.dtype)
  
      masks = (
          (x[None, ...] >= x_min)
          & (x[None, ...] < x_max)
          & (y[None, ...] >= y_min)
          & (y[None, ...] < y_max)
      )
      mask = tf.reduce_any(masks, axis=0)
  
      return tf.cast(mask[..., None], dtype=dtype)
  
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 1 for calling a global function with example usage: get_mask(image, denoise_configs, dtype) and returns: tf