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))
  
      # Can pass in input_data_format and works if data format is ambiguous or unknown.
      image = np.random.rand(4, 5, 6)
      image = to_channel_dimension_format(
          image, "channels_first", input_channel_dim="channels_last"
      )
      self.assertEqual(image.shape, (6, 4, 5))
  
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 7 for calling the ImageTransformsTester obj's underlying member method code with example usage: obj.test_to_channel_dimension_format() without return types