code: def cutout(image, pad_size, replace=0, seed=None):
      """Apply cutout (https://arxiv.org/abs/1708.04552) to image.
  
      Forked from learning/brain/research/meta_architect/image/image_processing.py?
        l=1172&rcl=193953073
  
      Args:
        image: Image `Tensor` with shape [height, width, channels].
        pad_size: The cutout shape will be at most [pad_size * 2, pad_size * 2].
        replace: Value for replacing cutout values.
        seed: Random seed.
  
      Returns:
        Image `Tensor` with cutout applied.
      """
  
      with tf.variable_scope("cutout"):
          image_height = tf.shape(image)[0]
          image_width = tf.shape(image)[1]
          image_depth = tf.shape(image)[2]
  
          # Sample the location in the image where the zero mask will be applied.
          cutout_center_height = tf.random_uniform(
              shape=[],
              minval=0,
              maxval=image_height,
              seed=seed,
              dtype=tf.int32,
          )
  
          cutout_center_width = tf.random_uniform(
              shape=[],
              minval=0,
              maxval=image_width,
              seed=seed,
              dtype=tf.int32,
          )
  
          lower_pad = tf.maximum(0, cutout_center_height - pad_size)
          upper_pad = tf.maximum(
              0, image_height - cutout_center_height - pad_size
          )
          left_pad = tf.maximum(0, cutout_center_width - pad_size)
          right_pad = tf.maximum(
              0, image_width - cutout_center_width - pad_size
          )
  
          cutout_shape = [
              image_height - (lower_pad + upper_pad),
              image_width - (left_pad + right_pad),
          ]
          padding_dims = [[lower_pad, upper_pad], [left_pad, right_pad]]
          mask = tf.pad(
              tf.zeros(cutout_shape, dtype=image.dtype),
              padding_dims,
              constant_values=1,
          )
          mask = tf.expand_dims(mask, -1)
          mask = tf.tile(mask, [1, 1, image_depth])
          image = tf.where(
              tf.equal(mask, 0),
              tf.ones_like(image, dtype=image.dtype) * replace,
              image,
          )
      return image
  
file_path: adanet/research/improve_nas/trainer/image_processing.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling a global function with example usage: cutout(image, pad_size, replace, seed) and returns: image