code: def get_resize_small(smaller_size, method="area", antialias=True):
      """Resizes the smaller side to `smaller_size` keeping aspect ratio.
  
      Args:
        smaller_size: an integer, that represents a new size of the smaller side of
          an input image.
        method: the resize method. `area` is a meaningful, bwd-compat default.
        antialias: See TF's image.resize method.
  
      Returns:
        A function, that resizes an image and preserves its aspect ratio.
  
      """
  
      def _resize_small(image):  # pylint: disable=missing-docstring
          h, w = tf.shape(image)[0], tf.shape(image)[1]
  
          # Figure out the necessary h/w.
          ratio = tf.cast(smaller_size, tf.float32) / tf.cast(
              tf.minimum(h, w), tf.float32
          )
          h = tf.cast(
              tf.round(tf.cast(h, tf.float32) * ratio), tf.int32
          )
          w = tf.cast(
              tf.round(tf.cast(w, tf.float32) * ratio), tf.int32
          )
  
          dtype = image.dtype
          image = tf2.image.resize(image, (h, w), method, antialias)
          return tf.cast(image, dtype)
  
      return _resize_small
  
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 10 for calling a global function with example usage: get_resize_small(smaller_size, method, antialias) and returns: _resize_small, tf