code: def get_extract_patches(patch_size, stride):
      """Extracts image patches.
  
      Args:
        patch_size: patch size.
        stride: patches stride.
  
      Returns:
         A function for extracting patches.
      """
  
      def _extract_patches(image):
          """Extracts image patches."""
          h, w, c = image.get_shape().as_list()
  
          count_h = h // stride
          count_w = w // stride
  
          # pyformat: disable
          image = tf.extract_image_patches(
              image[None],
              [1, patch_size, patch_size, 1],
              [1, stride, stride, 1],
              [1, 1, 1, 1],
              padding="VALID",
          )
          # pyformat: enable
  
          return tf.reshape(
              image, [count_h * count_w, patch_size, patch_size, c]
          )
  
      return _extract_patches
  
imports: from typing import Optional, Tuple
  import numpy
  from scenic.dataset_lib.big_transfer.preprocessing import autoaugment
  from scenic.dataset_lib.big_transfer.preprocessing import utils
  from scenic.dataset_lib.big_transfer.registry import Registry
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_addons import image
label_desc: Use image node_id 29 for calling a global function with example usage: get_extract_patches(patch_size, stride) and returns: _extract_patches, tf