class_docstr: Image processor for VAE.
  
  Args:
      do_resize (`bool`, *optional*, defaults to `True`):
          Whether to downscale the image's (height, width) dimensions to multiples of `vae_scale_factor`. Can accept
          `height` and `width` arguments from [`image_processor.VaeImageProcessor.preprocess`] method.
      vae_scale_factor (`int`, *optional*, defaults to `8`):
          VAE scale factor. If `do_resize` is `True`, the image is automatically resized to multiples of this factor.
      resample (`str`, *optional*, defaults to `lanczos`):
          Resampling filter to use when resizing the image.
      do_normalize (`bool`, *optional*, defaults to `True`):
          Whether to normalize the image to [-1,1].
      do_binarize (`bool`, *optional*, defaults to `False`):
          Whether to binarize the image to 0/1.
      do_convert_rgb (`bool`, *optional*, defaults to be `False`):
          Whether to convert the images to RGB format.
      do_convert_grayscale (`bool`, *optional*, defaults to be `False`):
          Whether to convert the images to grayscale format.
class_docstr_tok: ["Image","processor","for","VAE",".","Args",":","do_resize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","downscale","the","image","'s","(","height",",","width",")","dimensions","to","multiples","of","`","vae_scale_factor","`",".","Can","accept","`","height","`","and","`","width","`","arguments","from","[","`","image_processor.VaeImageProcessor.preprocess","`","]","method",".","vae_scale_factor","(","`","int","`",",","*","optional","*",",","defaults","to","`","8","`",")",":","VAE","scale","factor",".","If","`","do_resize","`","is","`","True","`",",","the","image","is","automatically","resized","to","multiples","of","this","factor",".","resample","(","`","str","`",",","*","optional","*",",","defaults","to","`","lanczos","`",")",":","Resampling","filter","to","use","when","resizing","the","image",".","do_normalize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","True","`",")",":","Whether","to","normalize","the","image","to","[","-1,1","]",".","do_binarize","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","to","binarize","the","image","to","0\/1",".","do_convert_rgb","(","`","bool","`",",","*","optional","*",",","defaults","to","be","`","False","`",")",":","Whether","to","convert","the","images","to","RGB","format",".","do_convert_grayscale","(","`","bool","`",",","*","optional","*",",","defaults","to","be","`","False","`",")",":","Whether","to","convert","the","images","to","grayscale","format","."]
docstr: Convert a NumPy image to a PyTorch tensor.
docstr_tok: ["Convert","a","NumPy","image","to","a","PyTorch","tensor","."]
code: def numpy_to_pt(images: np.ndarray) -> torch.FloatTensor:
      """
      Convert a NumPy image to a PyTorch tensor.
      """
      if images.ndim == 3:
          images = images[..., None]
  
      images = torch.from_numpy(images.transpose(0, 3, 1, 2))
      return images
  
imports: import warnings
  from typing import List, Optional, Union
  import numpy
  import PIL.Image
  import torch
  from PIL import Image
  from .configuration_utils import ConfigMixin, register_to_config
  from .utils import CONFIG_NAME, PIL_INTERPOLATION, deprecate
label_desc: Use image node_id 4 for calling the VaeImageProcessor obj's underlying member method code with example usage: obj.numpy_to_pt(images) and returns: images