class_docstr: Constructs a Vivit image processor.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
          `do_resize` parameter in the `preprocess` method.
      size (`Dict[str, int]` *optional*, defaults to `{"shortest_edge": 256}`):
          Size of the output image after resizing. The shortest edge of the image will be resized to
          `size["shortest_edge"]` while maintaining the aspect ratio of the original image. Can be overriden by
          `size` in the `preprocess` method.
      resample (`PILImageResampling`, *optional*, defaults to `Resampling.BILINEAR`):
          Resampling filter to use if resizing the image. Can be overridden by the `resample` parameter in the
          `preprocess` method.
      do_center_crop (`bool`, *optional*, defaults to `True`):
          Whether to center crop the image to the specified `crop_size`. Can be overridden by the `do_center_crop`
          parameter in the `preprocess` method.
      crop_size (`Dict[str, int]`, *optional*, defaults to `{"height": 224, "width": 224}`):
          Size of the image after applying the center crop. Can be overridden by the `crop_size` parameter in the
          `preprocess` method.
      do_rescale (`bool`, *optional*, defaults to `True`):
          Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by the `do_rescale`
          parameter in the `preprocess` method.
      rescale_factor (`int` or `float`, *optional*, defaults to `1/127.5`):
          Defines the scale factor to use if rescaling the image. Can be overridden by the `rescale_factor` parameter
          in the `preprocess` method.
      offset (`bool`, *optional*, defaults to `True`):
          Whether to scale the image in both negative and positive directions. Can be overriden by the `offset` in
          the `preprocess` method.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether to normalize the image. Can be overridden by the `do_normalize` parameter in the `preprocess`
          method.
      image_mean (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_MEAN`):
          Mean to use if normalizing the image. This is a float or list of floats the length of the number of
          channels in the image. Can be overridden by the `image_mean` parameter in the `preprocess` method.
      image_std (`float` or `List[float]`, *optional*, defaults to `IMAGENET_STANDARD_STD`):
          Standard deviation to use if normalizing the image. This is a float or list of floats the length of the
          number of channels in the image. Can be overridden by the `image_std` parameter in the `preprocess` method.
class_docstr_tok: ["Constructs","a","Vivit","image","processor",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","'s","(","height",",","width",")","dimensions","to","the","specified","`","size","`",".","Can","be","overridden","by","the","`","do_resize","`","parameter","in","the","`","preprocess","`","method",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","`","{","``","shortest_edge","''",":","256","}","`",")",":","Size","of","the","output","image","after","resizing",".","The","shortest","edge","of","the","image","will","be","resized","to","`","size","[","``","shortest_edge","''","]","`","while","maintaining","the","aspect","ratio","of","the","original","image",".","Can","be","overriden","by","`","size","`","in","the","`","preprocess","`","method",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","Resampling.BILINEAR","`",")",":","Resampling","filter","to","use","if","resizing","the","image",".","Can","be","overridden","by","the","`","resample","`","parameter","in","the","`","preprocess","`","method",".","do_center_crop","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","center","crop","the","image","to","the","specified","`","crop_size","`",".","Can","be","overridden","by","the","`","do_center_crop","`","parameter","in","the","`","preprocess","`","method",".","crop_size","(","`","Dict","[","str",",","int","]","`",",","*","optional","*",",","defaults","to","`","{","``","height","''",":","224",",","``","width","''",":","224","}","`",")",":","Size","of","the","image","after","applying","the","center","crop",".","Can","be","overridden","by","the","`","crop_size","`","parameter","in","the","`","preprocess","`","method",".","do_rescale","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","rescale","the","image","by","the","specified","scale","`","rescale_factor","`",".","Can","be","overridden","by","the","`","do_rescale","`","parameter","in","the","`","preprocess","`","method",".","rescale_factor","(","`","int","`","or","`","float","`",",","*","optional","*",",","defaults","to","`","1\/127.5","`",")",":","Defines","the","scale","factor","to","use","if","rescaling","the","image",".","Can","be","overridden","by","the","`","rescale_factor","`","parameter","in","the","`","preprocess","`","method",".","offset","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","scale","the","image","in","both","negative","and","positive","directions",".","Can","be","overriden","by","the","`","offset","`","in","the","`","preprocess","`","method",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","normalize","the","image",".","Can","be","overridden","by","the","`","do_normalize","`","parameter","in","the","`","preprocess","`","method",".","image_mean","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_STANDARD_MEAN","`",")",":","Mean","to","use","if","normalizing","the","image",".","This","is","a","float","or","list","of","floats","the","length","of","the","number","of","channels","in","the","image",".","Can","be","overridden","by","the","`","image_mean","`","parameter","in","the","`","preprocess","`","method",".","image_std","(","`","float","`","or","`","List","[","float","]","`",",","*","optional","*",",","defaults","to","`","IMAGENET_STANDARD_STD","`",")",":","Standard","deviation","to","use","if","normalizing","the","image",".","This","is","a","float","or","list","of","floats","the","length","of","the","number","of","channels","in","the","image",".","Can","be","overridden","by","the","`","image_std","`","parameter","in","the","`","preprocess","`","method","."]
docstr: Rescale an image by a scale factor.
  
  If `offset` is `True`, the image has its values rescaled by `scale` and then offset by 1. If `scale` is
  1/127.5, the image is rescaled between [-1, 1].
      image = image * scale - 1
  
  If `offset` is `False`, and `scale` is 1/255, the image is rescaled between [0, 1].
      image = image * scale
  
  Args:
      image (`np.ndarray`):
          Image to rescale.
      scale (`int` or `float`):
          Scale to apply to the image.
      offset (`bool`, *optional*):
          Whether to scale the image in both negative and positive directions.
      data_format (`str` or `ChannelDimension`, *optional*):
          The channel dimension format of the image. If not provided, it will be the same as the input image.
      input_data_format (`ChannelDimension` or `str`, *optional*):
          The channel dimension format of the input image. If not provided, it will be inferred.
docstr_tok: ["Rescale","an","image","by","a","scale","factor",".","If","`","offset","`","is","`","True","`",",","the","image","has","its","values","rescaled","by","`","scale","`","and","then","offset","by","1",".","If","`","scale","`","is","1\/127.5",",","the","image","is","rescaled","between","[","-1",",","1","]",".","image","=","image","*","scale","-","1","If","`","offset","`","is","`","False","`",",","and","`","scale","`","is","1\/255",",","the","image","is","rescaled","between","[","0",",","1","]",".","image","=","image","*","scale","Args",":","image","(","`","np.ndarray","`",")",":","Image","to","rescale",".","scale","(","`","int","`","or","`","float","`",")",":","Scale","to","apply","to","the","image",".","offset","(","`","bool","`",",","*","optional","*",")",":","Whether","to","scale","the","image","in","both","negative","and","positive","directions",".","data_format","(","`","str","`","or","`","ChannelDimension","`",",","*","optional","*",")",":","The","channel","dimension","format","of","the","image",".","If","not","provided",",","it","will","be","the","same","as","the","input","image",".","input_data_format","(","`","ChannelDimension","`","or","`","str","`",",","*","optional","*",")",":","The","channel","dimension","format","of","the","input","image",".","If","not","provided",",","it","will","be","inferred","."]
code: def rescale(
      self,
      image: np.ndarray,
      scale: Union[int, float],
      offset: bool = True,
      data_format: Optional[Union[str, ChannelDimension]] = None,
      input_data_format: Optional[Union[str, ChannelDimension]] = None,
      **kwargs,
  ):
      """
      Rescale an image by a scale factor.
  
      If `offset` is `True`, the image has its values rescaled by `scale` and then offset by 1. If `scale` is
      1/127.5, the image is rescaled between [-1, 1].
          image = image * scale - 1
  
      If `offset` is `False`, and `scale` is 1/255, the image is rescaled between [0, 1].
          image = image * scale
  
      Args:
          image (`np.ndarray`):
              Image to rescale.
          scale (`int` or `float`):
              Scale to apply to the image.
          offset (`bool`, *optional*):
              Whether to scale the image in both negative and positive directions.
          data_format (`str` or `ChannelDimension`, *optional*):
              The channel dimension format of the image. If not provided, it will be the same as the input image.
          input_data_format (`ChannelDimension` or `str`, *optional*):
              The channel dimension format of the input image. If not provided, it will be inferred.
      """
      rescaled_image = rescale(
          image,
          scale=scale,
          data_format=data_format,
          input_data_format=input_data_format,
          **kwargs,
      )
  
      if offset:
          rescaled_image = rescaled_image - 1
  
      return rescaled_image
  
file_path: transformers/src/transformers/models/vivit/image_processing_vivit.py
imports: from typing import Dict, List, Optional, Union
  import numpy
  from transformers.utils import is_vision_available
  from transformers.utils.generic import TensorType
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import get_resize_output_image_size, rescale, resize, to_channel_dimension_format
  from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, is_valid_image, to_numpy_array, valid_images
  from ...utils import logging
label_desc: Use image node_id 3 for calling the VivitImageProcessor obj's underlying member method code with example usage: obj.rescale(image, scale, offset, data_format, input_data_format) and returns: rescaled_image