code: def test_image(self):
      feature_extractor = ImageGPTFeatureExtractor.from_pretrained(
          "openai/imagegpt-small"
      )
  
      images = prepare_images()
  
      # test non-batched
      encoding = feature_extractor(images[0], return_tensors="pt")
  
      self.assertIsInstance(encoding.input_ids, torch.LongTensor)
      self.assertEqual(encoding.input_ids.shape, (1, 1024))
  
      expected_slice = [306, 191, 191]
      self.assertEqual(
          encoding.input_ids[0, :3].tolist(), expected_slice
      )
  
      # test batched
      encoding = feature_extractor(images, return_tensors="pt")
  
      self.assertIsInstance(encoding.input_ids, torch.LongTensor)
      self.assertEqual(encoding.input_ids.shape, (2, 1024))
  
      expected_slice = [303, 13, 13]
      self.assertEqual(
          encoding.input_ids[1, -3:].tolist(), expected_slice
      )
  
imports: import json
  import os
  import tempfile
  import unittest
  import numpy
  from datasets import load_dataset
  from transformers.testing_utils import require_torch, require_vision, slow
  from transformers.utils import is_torch_available, is_vision_available
  from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin
label_desc: Use image node_id 1 for calling the ImageGPTFeatureExtractorIntegrationTest obj's underlying member method code with example usage: obj.test_image() without return types