code: def test_get_resize_output_image_size(self):
      image = np.random.randint(0, 256, (3, 224, 224))
  
      # Test the output size defaults to (x, x) if an int is given.
      self.assertEqual(
          get_resize_output_image_size(image, 10), (10, 10)
      )
      self.assertEqual(
          get_resize_output_image_size(image, [10]), (10, 10)
      )
      self.assertEqual(
          get_resize_output_image_size(image, (10,)), (10, 10)
      )
  
      # Test the output size is the same as the input if a two element tuple/list is given.
      self.assertEqual(
          get_resize_output_image_size(image, (10, 20)), (10, 20)
      )
      self.assertEqual(
          get_resize_output_image_size(image, [10, 20]), (10, 20)
      )
      self.assertEqual(
          get_resize_output_image_size(
              image, (10, 20), default_to_square=True
          ),
          (10, 20),
      )
      # To match pytorch behaviour, max_size is only relevant if size is an int
      self.assertEqual(
          get_resize_output_image_size(image, (10, 20), max_size=5),
          (10, 20),
      )
  
      # Test output size = (int(size * height / width), size) if size is an int and height > width
      image = np.random.randint(0, 256, (3, 50, 40))
      self.assertEqual(
          get_resize_output_image_size(
              image, 20, default_to_square=False
          ),
          (25, 20),
      )
  
      # Test output size = (size, int(size * width / height)) if size is an int and width <= height
      image = np.random.randint(0, 256, (3, 40, 50))
      self.assertEqual(
          get_resize_output_image_size(
              image, 20, default_to_square=False
          ),
          (20, 25),
      )
  
      # Test size is resized if longer size > max_size
      image = np.random.randint(0, 256, (3, 50, 40))
      self.assertEqual(
          get_resize_output_image_size(
              image, 20, default_to_square=False, max_size=22
          ),
          (22, 17),
      )
  
      # Test output size = (int(size * height / width), size) if size is an int and height > width and
      # input has 4 channels
      image = np.random.randint(0, 256, (4, 50, 40))
      self.assertEqual(
          get_resize_output_image_size(
              image,
              20,
              default_to_square=False,
              input_data_format="channels_first",
          ),
          (25, 20),
      )
  
      # Test correct channel dimension is returned if output size if height == 3
      # Defaults to input format - channels first
      image = np.random.randint(0, 256, (3, 18, 97))
      resized_image = resize(image, (3, 20))
      self.assertEqual(resized_image.shape, (3, 3, 20))
  
      # Defaults to input format - channels last
      image = np.random.randint(0, 256, (18, 97, 3))
      resized_image = resize(image, (3, 20))
      self.assertEqual(resized_image.shape, (3, 20, 3))
  
      image = np.random.randint(0, 256, (3, 18, 97))
      resized_image = resize(
          image, (3, 20), data_format="channels_last"
      )
      self.assertEqual(resized_image.shape, (3, 20, 3))
  
      image = np.random.randint(0, 256, (18, 97, 3))
      resized_image = resize(
          image, (3, 20), data_format="channels_first"
      )
      self.assertEqual(resized_image.shape, (3, 3, 20))
  
imports: import unittest
  import numpy
  from parameterized import parameterized
  from transformers.testing_utils import require_flax, require_tf, require_torch, require_vision
  from transformers.utils.import_utils import is_flax_available, is_tf_available, is_torch_available, is_vision_available
label_desc: Use image node_id 8 for calling the ImageTransformsTester obj's underlying member method code with example usage: obj.test_get_resize_output_image_size() without return types