def testResizeToRangeSameMinMax(self):
    """Tests image resizing, checking output sizes."""
    in_shape_list = [[312, 312, 3], [299, 299, 3]]
    min_dim = 320
    max_dim = 320
    expected_shape_list = [[320, 320, 3], [320, 320, 3]]
    def graph_fn(in_shape):
      in_image = tf.random_uniform(in_shape)
      out_image, _ = preprocessor.resize_to_range(
          in_image, min_dimension=min_dim, max_dimension=max_dim)
      out_image_shape = tf.shape(out_image)
      return out_image_shape
    for in_shape, expected_shape in zip(in_shape_list, expected_shape_list):
      out_image_shape = self.execute_cpu(graph_fn, [np.array(in_shape,
                                                             np.int32)])
      self.assertAllEqual(out_image_shape, expected_shape)
Tests image resizing, checking output sizes.
inference_api/src/main/object_detection/core/preprocessor_test.py