code: def _do_scale(image, size):
    
    shape = tf.cast(tf.shape(image), tf.float32)
    w_greater = tf.greater(shape[0], shape[1])
    shape = tf.cond(w_greater,
                    lambda: tf.cast([shape[0] / shape[1] * size, size], tf.int32),
                    lambda: tf.cast([size, shape[1] / shape[0] * size], tf.int32))
  
    return tf.image.resize_bicubic([image], shape)[0]
docs: Rescale the image by scaling the smaller spatial dimension to `size`.