class_docstr: Constructs an ImageGPT feature extractor. This feature extractor can be used to resize images to a smaller
  resolution (such as 32x32 or 64x64), normalize them and finally color quantize them to obtain sequences of "pixel
  values" (color clusters).
  
  This feature extractor inherits from [`FeatureExtractionMixin`] which contains most of the main methods. Users
  should refer to this superclass for more information regarding those methods.
  
  Args:
      clusters (`np.ndarray`):
          The color clusters to use, as a `np.ndarray` of shape `(n_clusters, 3)`.
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the input to a certain `size`.
      size (`int` or `Tuple(int)`, *optional*, defaults to 32):
          Resize the input to the given size. If a tuple is provided, it should be (width, height). If only an
          integer is provided, then the input will be resized to (size, size). Only has an effect if `do_resize` is
          set to `True`.
      resample (`int`, *optional*, defaults to `PIL.Image.Resampling.BILINEAR`):
          An optional resampling filter. This can be one of `PIL.Image.Resampling.NEAREST`,
          `PIL.Image.Resampling.BOX`, `PIL.Image.Resampling.BILINEAR`, `PIL.Image.Resampling.HAMMING`,
          `PIL.Image.Resampling.BICUBIC` or `PIL.Image.Resampling.LANCZOS`. Only has an effect if `do_resize` is set
          to `True`.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether or not to normalize the input to the range between -1 and +1.
class_docstr_tok: ["Constructs","an","ImageGPT","feature","extractor",".","This","feature","extractor","can","be","used","to","resize","images","to","a","smaller","resolution","(","such","as","32x32","or","64x64",")",",","normalize","them","and","finally","color","quantize","them","to","obtain","sequences","of","``","pixel","values","''","(","color","clusters",")",".","This","feature","extractor","inherits","from","[","`","FeatureExtractionMixin","`","]","which","contains","most","of","the","main","methods",".","Users","should","refer","to","this","superclass","for","more","information","regarding","those","methods",".","Args",":","clusters","(","`","np.ndarray","`",")",":","The","color","clusters","to","use",",","as","a","`","np.ndarray","`","of","shape","`","(","n_clusters",",","3",")","`",".","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","input","to","a","certain","`","size","`",".","size","(","`","int","`","or","`","Tuple","(","int",")","`",",","*","optional","*",",","defaults","to","32",")",":","Resize","the","input","to","the","given","size",".","If","a","tuple","is","provided",",","it","should","be","(","width",",","height",")",".","If","only","an","integer","is","provided",",","then","the","input","will","be","resized","to","(","size",",","size",")",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","resample","(","`","int","`",",","*","optional","*",",","defaults","to","`","PIL.Image.Resampling.BILINEAR","`",")",":","An","optional","resampling","filter",".","This","can","be","one","of","`","PIL.Image.Resampling.NEAREST","`",",","`","PIL.Image.Resampling.BOX","`",",","`","PIL.Image.Resampling.BILINEAR","`",",","`","PIL.Image.Resampling.HAMMING","`",",","`","PIL.Image.Resampling.BICUBIC","`","or","`","PIL.Image.Resampling.LANCZOS","`",".","Only","has","an","effect","if","`","do_resize","`","is","set","to","`","True","`",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","or","not","to","normalize","the","input","to","the","range","between","-1","and","+1","."]
docstr: Normalizes `image` into the range -1 to +1.
  
  Args:
      image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
          The image to normalize.
  
  Returns:
      `np.ndarray`: The normalized image.
docstr_tok: ["Normalizes","`","image","`","into","the","range","-1","to","+1",".","Args",":","image","(","`","PIL.Image.Image","`","or","`","np.ndarray","`","or","`","torch.Tensor","`",")",":","The","image","to","normalize",".","Returns",":","`","np.ndarray","`",":","The","normalized","image","."]
code: def normalize(self, image):
      """
      Normalizes `image` into the range -1 to +1.
  
      Args:
          image (`PIL.Image.Image` or `np.ndarray` or `torch.Tensor`):
              The image to normalize.
  
      Returns:
          `np.ndarray`: The normalized image.
      """
      image = self.to_numpy_array(
          image, rescale=False, channel_first=False
      )
  
      return image / 127.5 - 1
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/models/imagegpt/feature_extraction_imagegpt.py
imports: from typing import List, Optional, Union
  import numpy
  from PIL import Image
  from transformers.image_utils import PILImageResampling
  from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin
  from ...image_utils import ImageFeatureExtractionMixin, is_torch_tensor
  from ...utils import TensorType, logging
label_desc: Use image node_id 2 for calling the ImageGPTFeatureExtractor obj's underlying member method code with example usage: obj.normalize(image) and returns: unknown