(image, smallest_side)
return resized_image
Resize images preserving the original aspect ratio.

  Args:
    image: A 3-D image `Tensor`.
    smallest_side: A python integer or scalar `Tensor` indicating the size of
      the smallest side after resize.

  Returns:
    resized_image: A 3-D tensor containing the resized image.
Resize images preserving the original aspect ratio.
Resize images preserving the original aspect ratio .
def _aspect_preserving_resize(image, smallest_side):
  """Resize images preserving the original aspect ratio.

  Args:
    image: A 3-D image `Tensor`.
    smallest_side: A python integer or scalar `Tensor` indicating the size of
      the smallest side after resize.

  Returns:
    resized_image: A 3-D tensor containing the resized image.
  """
  smallest_side = tf.convert_to_tensor(smallest_side, dtype=tf.int32)

  shape = tf.shape(image)
  height = shape[0]
  width = shape[1]
  new_height, new_width = _smallest_size_at_least(height, width, smallest_side)
  image = tf.expand_dims(image, 0)
  resized_image = tf.image.resize_bilinear(image, [new_height, new_width],
                                           align_corners=False)
  resized_image = tf.squeeze(resized_image)
  resized_image.set_shape([None, None, 3])
  return resized_image
def _aspect_preserving_resize ( image , smallest_side ) : smallest_side = tf . convert_to_tensor ( smallest_side , dtype = tf . int32 ) shape = tf . shape ( image ) height = shape [ 0 ] width = shape [ 1 ] new_height , new_width = _smallest_size_at_least ( height , width , smallest_side ) image = tf . expand_dims ( image , 0 ) resized_image = tf . image . resize_bilinear ( image , [ new_height , new_width ] , align_corners = False ) resized_image = tf . squeeze ( resized_image ) resized_image . set_shape ( [ None , None , 3 ] ) return resized_image