def _smallest_size_at_least(height, width, smallest_side):
 smallest_side = tf.convert_to_tensor(smallest_side, dtype=tf.int32)
 height = tf.to_float(height)
 width = tf.to_float(width)
 smallest_side = tf.to_float(smallest_side)
 scale = tf.cond(tf.greater(height, width), (lambda : (smallest_side / width)), (lambda : (smallest_side / height)))
 new_height = tf.to_int32((height * scale))
 new_width = tf.to_int32((width * scale))
 return (new_height, new_width)

def _smallest_size_at_least ( height , width , smallest_side ) : smallest_side = tf . convert_to_tensor ( smallest_side , dtype = tf . int32 ) height = tf . to_float ( height ) width = tf . to_float ( width ) smallest_side = tf . to_float ( smallest_side ) scale = tf . cond ( tf . greater ( height , width ) , ( lambda : ( smallest_side / width ) ) , ( lambda : ( smallest_side / height ) ) ) new_height = tf . to_int32 ( ( height * scale ) ) new_width = tf . to_int32 ( ( width * scale ) ) return ( new_height , new_width )
computes new shape with the smallest side equal to smallest_side .