code: def test_conversion_array_to_array(self):
      feature_extractor = ImageFeatureExtractionMixin()
      array = np.random.randint(0, 256, (16, 32, 3), dtype=np.uint8)
  
      # By default, rescale (for an array of ints) and channel permute
      array1 = feature_extractor.to_numpy_array(array)
      self.assertTrue(array1.dtype, np.float32)
      self.assertEqual(array1.shape, (3, 16, 32))
      self.assertTrue(
          np.array_equal(
              array1,
              array.transpose(2, 0, 1).astype(np.float32) * (1 / 255.0),
          )
      )
  
      # Same with no permute
      array2 = feature_extractor.to_numpy_array(
          array, channel_first=False
      )
      self.assertTrue(array2.dtype, np.float32)
      self.assertEqual(array2.shape, (16, 32, 3))
      self.assertTrue(
          np.array_equal(array2, array.astype(np.float32) * (1 / 255.0))
      )
  
      # Force rescale to False
      array3 = feature_extractor.to_numpy_array(array, rescale=False)
      self.assertTrue(array3.dtype, np.uint8)
      self.assertEqual(array3.shape, (3, 16, 32))
      self.assertTrue(np.array_equal(array3, array.transpose(2, 0, 1)))
  
      # Force rescale to False and no channel permute
      array4 = feature_extractor.to_numpy_array(
          array, rescale=False, channel_first=False
      )
      self.assertTrue(array4.dtype, np.uint8)
      self.assertEqual(array4.shape, (16, 32, 3))
      self.assertTrue(np.array_equal(array4, array))
  
      # Now test the default rescale for a float array (defaults to False)
      array5 = feature_extractor.to_numpy_array(array2)
      self.assertTrue(array5.dtype, np.float32)
      self.assertEqual(array5.shape, (3, 16, 32))
      self.assertTrue(np.array_equal(array5, array1))
  
imports: import os
  import tempfile
  import unittest
  import datasets
  import numpy
  import pytest
  from huggingface_hub.file_download import http_get
  from requests import ConnectTimeout, ReadTimeout
  from tests.pipelines.test_pipelines_document_question_answering import INVOICE_URL
  from transformers import is_torch_available, is_vision_available
  from transformers.image_utils import ChannelDimension, get_channel_dimension_axis, make_list_of_images
  from transformers.testing_utils import is_flaky, require_torch, require_vision
label_desc: Use image node_id 2 for calling the ImageFeatureExtractionTester obj's underlying member method code with example usage: obj.test_conversion_array_to_array() without return types