class_docstr: This class allow the user to run multiple query with multiple prompts for a model.
  
  At the moment, we just support the SAM model. The model is loaded based on the given config.
  
  For default the images are transformed to have their long side with size of the `image_encoder.img_size`. This
  Prompter class ensure to transform the images and the prompts before prediction. Also, the image is passed
  automatically for the method `preprocess_image`, which is responsible for normalize the image and pad it to have
  the right size for the SAM model :math:`(   ext{image_encoder.img_size},    ext{image_encoder.img_size})`. For
  default the image is normalized by the mean and standard deviation of the SAM dataset values.
  
  Args:
      config: A model config to generate the model. Now just the SAM model is supported.
      device: The desired device to use the model.
      dtype: The desired dtype to use the model.
  
  Example:
      >>> # prompter = ImagePrompter() # Will load the vit h for default
      >>> # You can load a custom SAM type for modifying the config
      >>> prompter = ImagePrompter(SamConfig('vit_b'))
      >>> image = torch.rand(3, 25, 30)
      >>> prompter.set_image(image)
      >>> boxes = Boxes(
      ...    torch.tensor(
      ...         [[[[0, 0], [0, 10], [10, 0], [10, 10]]]],
      ...         device=prompter.device,
      ...         dtype=torch.float32
      ...    ),
      ...    mode='xyxy'
      ... )
      >>> prediction = prompter.predict(boxes=boxes)
      >>> prediction.logits.shape
      torch.Size([1, 3, 256, 256])
docstr: Validate and preprocess the given prompts to be aligned with the input image.
docstr_tok: ["Validate","and","preprocess","the","given","prompts","to","be","aligned","with","the","input","image","."]
code: def preprocess_prompts(
      self,
      keypoints: Optional[Union[Keypoints, Tensor]] = None,
      keypoints_labels: Optional[Tensor] = None,
      boxes: Optional[Union[Boxes, Tensor]] = None,
      masks: Optional[Tensor] = None,
  ) -> Prompts:
      """Validate and preprocess the given prompts to be aligned with the input image."""
      data_keys = []
      to_transform: list[Keypoints | Boxes | Tensor] = []
  
      if isinstance(keypoints, (Keypoints, Tensor)) and isinstance(
          keypoints_labels, Tensor
      ):
          keypoints = self._valid_keypoints(keypoints, keypoints_labels)
          data_keys.append("keypoints")
          to_transform.append(keypoints)
  
      if isinstance(boxes, (Boxes, Tensor)):
          self._valid_boxes(boxes)
          data_keys.append("bbox_xyxy")
          to_transform.append(boxes)
  
      if isinstance(masks, Tensor):
          self._valid_masks(masks)
  
      data = self._transform_prompts(*to_transform, data_keys=data_keys)
  
      if "keypoints" in data and isinstance(
          data["keypoints"], Keypoints
      ):
          kpts_tensor = data["keypoints"].to_tensor()
          if KORNIA_CHECK_IS_TENSOR(
              kpts_tensor
          ) and KORNIA_CHECK_IS_TENSOR(keypoints_labels):
              points = (kpts_tensor[None, ...], keypoints_labels)
      else:
          points = None
  
      if "bbox_xyxy" in data and isinstance(data["bbox_xyxy"], Boxes):
          _bbox = data["bbox_xyxy"].to_tensor(mode="xyxy")
          if KORNIA_CHECK_IS_TENSOR(_bbox):
              bbox = _bbox
      else:
          bbox = None
  
      return Prompts(points=points, boxes=bbox, masks=masks)
  
imports: from __future__ import annotations
  import warnings
  from typing import Any, Optional, Union
  import torch
  from kornia.augmentation import LongestMaxSize
  from kornia.augmentation.container.augment import AugmentationSequential
  from kornia.contrib.models import Prompts, SegmentationResults
  from kornia.contrib.models.sam import Sam, SamConfig
  from kornia.core import Tensor, pad, tensor
  from kornia.core.check import KORNIA_CHECK, KORNIA_CHECK_IS_TENSOR, KORNIA_CHECK_SHAPE
  from kornia.enhance import normalize
  from kornia.geometry.boxes import Boxes
  from kornia.geometry.keypoints import Keypoints
label_desc: Use image node_id 8 for calling the ImagePrompter obj's underlying member method code with example usage: obj.preprocess_prompts(keypoints, keypoints_labels, boxes, masks) and returns: Prompts