class_docstr: Constructs a DPT image processor.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to resize the image's (height, width) dimensions. Can be overidden by `do_resize` in `preprocess`.
      size (`Dict[str, int]` *optional*, defaults to `{"height": 384, "width": 384}`):
          Size of the image after resizing. Can be overidden by `size` in `preprocess`.
      resample (`PILImageResampling`, *optional*, defaults to `Resampling.BICUBIC`):
          Defines the resampling filter to use if resizing the image. Can be overidden by `resample` in `preprocess`.
      keep_aspect_ratio (`bool`, *optional*, defaults to `False`):
          If `True`, the image is resized to the largest possible size such that the aspect ratio is preserved. Can
          be overidden by `keep_aspect_ratio` in `preprocess`.
      ensure_multiple_of (`int`, *optional*, defaults to 1):
          If `do_resize` is `True`, the image is resized to a size that is a multiple of this value. Can be overidden
          by `ensure_multiple_of` in `preprocess`.
      do_rescale (`bool`, *optional*, defaults to `True`):
          Whether to rescale the image by the specified scale `rescale_factor`. Can be overidden by `do_rescale` in
          `preprocess`.
      rescale_factor (`int` or `float`, *optional*, defaults to `1/255`):
          Scale factor to use if rescaling the image. Can be overidden by `rescale_factor` in `preprocess`.
      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.
      do_pad (`bool`, *optional*, defaults to `False`):
          Whether to apply center padding. This was introduced in the DINOv2 paper, which uses the model in
          combination with DPT.
      size_divisor (`int`, *optional*):
          If `do_pad` is `True`, pads the image dimensions to be divisible by this value. This was introduced in the
          DINOv2 paper, which uses the model in combination with DPT.
class_docstr_tok: ["Constructs","a","DPT","image","processor",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","resize","the","image","'s","(","height",",","width",")","dimensions",".","Can","be","overidden","by","`","do_resize","`","in","`","preprocess","`",".","size","(","`","Dict","[","str",",","int","]","`","*","optional","*",",","defaults","to","`","{","``","height","''",":","384",",","``","width","''",":","384","}","`",")",":","Size","of","the","image","after","resizing",".","Can","be","overidden","by","`","size","`","in","`","preprocess","`",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","Resampling.BICUBIC","`",")",":","Defines","the","resampling","filter","to","use","if","resizing","the","image",".","Can","be","overidden","by","`","resample","`","in","`","preprocess","`",".","keep_aspect_ratio","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","If","`","True","`",",","the","image","is","resized","to","the","largest","possible","size","such","that","the","aspect","ratio","is","preserved",".","Can","be","overidden","by","`","keep_aspect_ratio","`","in","`","preprocess","`",".","ensure_multiple_of","(","`","int","`",",","*","optional","*",",","defaults","to","1",")",":","If","`","do_resize","`","is","`","True","`",",","the","image","is","resized","to","a","size","that","is","a","multiple","of","this","value",".","Can","be","overidden","by","`","ensure_multiple_of","`","in","`","preprocess","`",".","do_rescale","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","rescale","the","image","by","the","specified","scale","`","rescale_factor","`",".","Can","be","overidden","by","`","do_rescale","`","in","`","preprocess","`",".","rescale_factor","(","`","int","`","or","`","float","`",",","*","optional","*",",","defaults","to","`","1\/255","`",")",":","Scale","factor","to","use","if","rescaling","the","image",".","Can","be","overidden","by","`","rescale_factor","`","in","`","preprocess","`",".","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",".","do_pad","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","apply","center","padding",".","This","was","introduced","in","the","DINOv2","paper",",","which","uses","the","model","in","combination","with","DPT",".","size_divisor","(","`","int","`",",","*","optional","*",")",":","If","`","do_pad","`","is","`","True","`",",","pads","the","image","dimensions","to","be","divisible","by","this","value",".","This","was","introduced","in","the","DINOv2","paper",",","which","uses","the","model","in","combination","with","DPT","."]
docstr: Resize an image to target size `(size["height"], size["width"])`. If `keep_aspect_ratio` is `True`, the image
  is resized to the largest possible size such that the aspect ratio is preserved. If `ensure_multiple_of` is
  set, the image is resized to a size that is a multiple of this value.
  
  Args:
      image (`np.ndarray`):
          Image to resize.
      size (`Dict[str, int]`):
          Target size of the output image.
      keep_aspect_ratio (`bool`, *optional*, defaults to `False`):
          If `True`, the image is resized to the largest possible size such that the aspect ratio is preserved.
      ensure_multiple_of (`int`, *optional*, defaults to 1):
          The image is resized to a size that is a multiple of this value.
      resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BICUBIC`):
          Defines the resampling filter to use if resizing the image. Otherwise, the image is resized to size
          specified in `size`.
      resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BICUBIC`):
          Resampling filter to use when resiizing the image.
      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 (`str` or `ChannelDimension`, *optional*):
          The channel dimension format of the input image. If not provided, it will be inferred.
docstr_tok: ["Resize","an","image","to","target","size","`","(","size","[","``","height","''","]",",","size","[","``","width","''","]",")","`",".","If","`","keep_aspect_ratio","`","is","`","True","`",",","the","image","is","resized","to","the","largest","possible","size","such","that","the","aspect","ratio","is","preserved",".","If","`","ensure_multiple_of","`","is","set",",","the","image","is","resized","to","a","size","that","is","a","multiple","of","this","value",".","Args",":","image","(","`","np.ndarray","`",")",":","Image","to","resize",".","size","(","`","Dict","[","str",",","int","]","`",")",":","Target","size","of","the","output","image",".","keep_aspect_ratio","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","If","`","True","`",",","the","image","is","resized","to","the","largest","possible","size","such","that","the","aspect","ratio","is","preserved",".","ensure_multiple_of","(","`","int","`",",","*","optional","*",",","defaults","to","1",")",":","The","image","is","resized","to","a","size","that","is","a","multiple","of","this","value",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","PILImageResampling.BICUBIC","`",")",":","Defines","the","resampling","filter","to","use","if","resizing","the","image",".","Otherwise",",","the","image","is","resized","to","size","specified","in","`","size","`",".","resample","(","`","PILImageResampling","`",",","*","optional","*",",","defaults","to","`","PILImageResampling.BICUBIC","`",")",":","Resampling","filter","to","use","when","resiizing","the","image",".","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","(","`","str","`","or","`","ChannelDimension","`",",","*","optional","*",")",":","The","channel","dimension","format","of","the","input","image",".","If","not","provided",",","it","will","be","inferred","."]
code: def resize(
      self,
      image: np.ndarray,
      size: Dict[str, int],
      keep_aspect_ratio: bool = False,
      ensure_multiple_of: int = 1,
      resample: PILImageResampling = PILImageResampling.BICUBIC,
      data_format: Optional[Union[str, ChannelDimension]] = None,
      input_data_format: Optional[Union[str, ChannelDimension]] = None,
      **kwargs,
  ) -> np.ndarray:
      """
      Resize an image to target size `(size["height"], size["width"])`. If `keep_aspect_ratio` is `True`, the image
      is resized to the largest possible size such that the aspect ratio is preserved. If `ensure_multiple_of` is
      set, the image is resized to a size that is a multiple of this value.
  
      Args:
          image (`np.ndarray`):
              Image to resize.
          size (`Dict[str, int]`):
              Target size of the output image.
          keep_aspect_ratio (`bool`, *optional*, defaults to `False`):
              If `True`, the image is resized to the largest possible size such that the aspect ratio is preserved.
          ensure_multiple_of (`int`, *optional*, defaults to 1):
              The image is resized to a size that is a multiple of this value.
          resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BICUBIC`):
              Defines the resampling filter to use if resizing the image. Otherwise, the image is resized to size
              specified in `size`.
          resample (`PILImageResampling`, *optional*, defaults to `PILImageResampling.BICUBIC`):
              Resampling filter to use when resiizing the image.
          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 (`str` or `ChannelDimension`, *optional*):
              The channel dimension format of the input image. If not provided, it will be inferred.
      """
      size = get_size_dict(size)
      if "height" not in size or "width" not in size:
          raise ValueError(
              f"The size dictionary must contain the keys 'height' and 'width'. Got {size.keys()}"
          )
  
      output_size = get_resize_output_image_size(
          image,
          output_size=(size["height"], size["width"]),
          keep_aspect_ratio=keep_aspect_ratio,
          multiple=ensure_multiple_of,
          input_data_format=input_data_format,
      )
      return resize(
          image,
          size=output_size,
          resample=resample,
          data_format=data_format,
          input_data_format=input_data_format,
          **kwargs,
      )
  
file_path: transformers/src/transformers/models/dpt/image_processing_dpt.py
imports: import math
  from typing import Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import pad, resize, to_channel_dimension_format
  from ...image_utils import IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, is_torch_available, is_torch_tensor, make_list_of_images, to_numpy_array, valid_images
  from ...utils import TensorType, is_vision_available, logging
label_desc: Use image node_id 2 for calling the DPTImageProcessor obj's underlying member method code with example usage: obj.resize(image, size, keep_aspect_ratio, ensure_multiple_of, resample, data_format, input_data_format) and returns: resize