code: def get_size_with_aspect_ratio(image_size, size, max_size=None):
      """Output (h, w) such that smallest side in image_size resizes to size."""
      h, w = image_size[0], image_size[1]
      if max_size is not None:
          max_size = tf_float(max_size)
          min_original_size = tf_float(tf.minimum(w, h))
          max_original_size = tf_float(tf.maximum(w, h))
          if (
              max_original_size / min_original_size * tf_float(size)
              > max_size
          ):
              size = tf_int32(
                  tf.floor(
                      max_size * min_original_size / max_original_size
                  )
              )
  
      if (w <= h and tf.equal(w, size)) or (
          h <= w and tf.equal(h, size)
      ):
          return (h, w)
  
      if w < h:
          ow = size
          oh = tf_int32(size * h / w)
      else:
          oh = size
          ow = tf_int32(size * w / h)
  
      return (oh, ow)
  
imports: from typing import Any, Dict
  import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: get_size_with_aspect_ratio(image_size, size, max_size) and returns: oh,  ow, h,  w