code: def test_to_channel_dimension_format(self):
      # Test that function doesn't reorder if channel dim matches the input.
      image = np.random.rand(3, 4, 5)
      image = to_channel_dimension_format(image, "channels_first")
      self.assertEqual(image.shape, (3, 4, 5))
  
      image = np.random.rand(4, 5, 3)
      image = to_channel_dimension_format(image, "channels_last")
      self.assertEqual(image.shape, (4, 5, 3))
  
      # Test that function reorders if channel dim doesn't match the input.
      image = np.random.rand(3, 4, 5)
      image = to_channel_dimension_format(image, "channels_last")
      self.assertEqual(image.shape, (4, 5, 3))
  
      image = np.random.rand(4, 5, 3)
      image = to_channel_dimension_format(image, "channels_first")
      self.assertEqual(image.shape, (3, 4, 5))
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/tests/test_image_transforms.py
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 5 for calling the ImageTransformsTester obj's underlying member method code with example usage: obj.test_to_channel_dimension_format() without return types