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 = VisualPrompter() # Will load the vit h for default
      >>> # You can load a custom SAM type for modifying the config
      >>> prompter = VisualPrompter(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])
class_docstr_tok: ["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","=","VisualPrompter","(",")","#","Will","load","the","vit","h","for","default",">",">",">","#","You","can","load","a","custom","SAM","type","for","modifying","the","config",">",">",">","prompter","=","VisualPrompter","(","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: Applies `torch.compile(...)`/dynamo API into the VisualPrompter API.
  
  .. note:: For more information about the dynamo API check the official docs
            https://pytorch.org/docs/stable/generated/torch.compile.html
  
  Args:
      fullgraph: Whether it is ok to break model into several subgraphs
      dynamic: Use dynamic shape tracing
      backend: backend to be used
      mode: Can be either “default”, “reduce-overhead” or “max-autotune”
      options: A dictionary of options to pass to the backend.
      disable: Turn torch.compile() into a no-op for testing
  
  Example:
      >>> # prompter = VisualPrompter()
      >>> # prompter.compile() # You should have torch >= 2.0.0 installed
      >>> # Use the prompter methods ...
docstr_tok: ["Applies","`","torch.compile","(","...",")","`","\/dynamo","API","into","the","VisualPrompter","API",".","..","note",":",":","For","more","information","about","the","dynamo","API","check","the","official","docs","https",":","\/\/pytorch.org\/docs\/stable\/generated\/torch.compile.html","Args",":","fullgraph",":","Whether","it","is","ok","to","break","model","into","several","subgraphs","dynamic",":","Use","dynamic","shape","tracing","backend",":","backend","to","be","used","mode",":","Can","be","either","\u201c","default","\u201d",",","\u201c","reduce-overhead","\u201d","or","\u201c","max-autotune","\u201d","options",":","A","dictionary","of","options","to","pass","to","the","backend",".","disable",":","Turn","torch.compile","(",")","into","a","no-op","for","testing","Example",":",">",">",">","#","prompter","=","VisualPrompter","(",")",">",">",">","#","prompter.compile","(",")","#","You","should","have","torch",">","=","2.0.0","installed",">",">",">","#","Use","the","prompter","methods","..."]
code: def compile(
      self,
      *,
      fullgraph: bool = False,
      dynamic: bool = False,
      backend: str = "inductor",
      mode: Optional[str] = None,
      options: dict[Any, Any] = {},
      disable: bool = False,
  ) -> None:
      """Applies `torch.compile(...)`/dynamo API into the VisualPrompter API.
  
      .. note:: For more information about the dynamo API check the official docs
                https://pytorch.org/docs/stable/generated/torch.compile.html
  
      Args:
          fullgraph: Whether it is ok to break model into several subgraphs
          dynamic: Use dynamic shape tracing
          backend: backend to be used
          mode: Can be either “default”, “reduce-overhead” or “max-autotune”
          options: A dictionary of options to pass to the backend.
          disable: Turn torch.compile() into a no-op for testing
  
      Example:
          >>> # prompter = VisualPrompter()
          >>> # prompter.compile() # You should have torch >= 2.0.0 installed
          >>> # Use the prompter methods ...
      """
  
      # self.set_image = torch.compile(  # type: ignore[method-assign]
      #     self.set_image,
      #     fullgraph=fullgraph,
      #     dynamic=dynamic,
      #     backend=backend,
      #     mode=mode,
      #     options=options,
      #     disable=disable,
      # )
      # FIXME: compile set image will try to compile AugmentationSequential which fails
      self.model.image_encoder = torch.compile(  # type: ignore
          self.model.image_encoder,
          fullgraph=fullgraph,
          dynamic=dynamic,
          backend=backend,
          mode=mode,
          options=options,
          disable=disable,
      )
  
      # self.preprocess_image = torch.compile(  # type: ignore[method-assign]
      #     self.preprocess_image,
      #     fullgraph=fullgraph,
      #     dynamic=dynamic,
      #     backend=backend,
      #     mode=mode,
      #     options=options,
      #     disable=disable,
      # )
  
      # FIXME: compile predict will try to compile Preproc prompts, which need to compileAugmentationSequential
      # which fails
      # self.predict = torch.compile(  # type: ignore[method-assign]
      #     self.predict,
      #     fullgraph=fullgraph,
      #     dynamic=dynamic,
      #     backend=backend,
      #     mode=mode,
      #     options=options,
      #     disable=disable,
      # )
      self.model.mask_decoder = torch.compile(  # type: ignore
          self.model.mask_decoder,
          fullgraph=fullgraph,
          dynamic=dynamic,
          backend=backend,
          mode=mode,
          options=options,
          disable=disable,
      )
      self.model.prompt_encoder = torch.compile(  # type: ignore
          self.model.prompt_encoder,
          fullgraph=fullgraph,
          dynamic=dynamic,
          backend=backend,
          mode=mode,
          options=options,
          disable=disable,
      )
  
imports: from __future__ import annotations
  from typing import Any, Optional
  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 11 for calling the VisualPrompter obj's underlying member method code with example usage: obj.compile() without return types