code: def _compute_new_static_size(image, min_dimension, max_dimension):
      """Compute new static shape for resize_to_range method."""
      image_shape = image.get_shape().as_list()
      orig_height = image_shape[0]
      orig_width = image_shape[1]
      num_channels = image_shape[2]
      orig_min_dim = min(orig_height, orig_width)
      # Calculates the larger of the possible sizes
      large_scale_factor = min_dimension / float(orig_min_dim)
      # Scaling orig_(height|width) by large_scale_factor will make the smaller
      # dimension equal to min_dimension, save for floating point rounding errors.
      # For reasonably-sized images, taking the nearest integer will reliably
      # eliminate this error.
      large_height = int(round(orig_height * large_scale_factor))
      large_width = int(round(orig_width * large_scale_factor))
      large_size = [large_height, large_width]
      if max_dimension:
          # Calculates the smaller of the possible sizes, use that if the larger
          # is too big.
          orig_max_dim = max(orig_height, orig_width)
          small_scale_factor = max_dimension / float(orig_max_dim)
          # Scaling orig_(height|width) by small_scale_factor will make the larger
          # dimension equal to max_dimension, save for floating point rounding
          # errors. For reasonably-sized images, taking the nearest integer will
          # reliably eliminate this error.
          small_height = int(round(orig_height * small_scale_factor))
          small_width = int(round(orig_width * small_scale_factor))
          small_size = [small_height, small_width]
          new_size = large_size
          if max(large_size) > max_dimension:
              new_size = small_size
      else:
          new_size = large_size
      return tf.constant(new_size + [num_channels])
  
file_path: DALI/docs/examples/use_cases/tensorflow/efficientdet/pipeline/tf/preprocessor.py
imports: import tensorflow.compat.v1
  from pipeline.anchors_utils import box_list
label_desc: Use image node_id 5 for calling a global function with example usage: _compute_new_static_size(image, min_dimension, max_dimension) and returns: tf