docstr: Embeds different types of prompts, returning both sparse and dense embeddings.
  
  Args:
      points: point coordinates and labels to embed.
      boxes: boxes to embed
      masks: masks to embed
  
  Returns:
      - sparse embeddings for the points and boxes, with shape BxNx(embed_dim), where N is determined by the
      number of input points and boxes.
      - dense embeddings for the masks, in the shape Bx(embed_dim)x(embed_H)x(embed_W)
docstr_tok: ["Embeds","different","types","of","prompts",",","returning","both","sparse","and","dense","embeddings",".","Args",":","points",":","point","coordinates","and","labels","to","embed",".","boxes",":","boxes","to","embed","masks",":","masks","to","embed","Returns",":","-","sparse","embeddings","for","the","points","and","boxes",",","with","shape","BxNx","(","embed_dim",")",",","where","N","is","determined","by","the","number","of","input","points","and","boxes",".","-","dense","embeddings","for","the","masks",",","in","the","shape","Bx","(","embed_dim",")","x","(","embed_H",")","x","(","embed_W",")"]
code: def forward(
      self,
      points: Optional[tuple[Tensor, Tensor]],
      boxes: Optional[Tensor],
      masks: Optional[Tensor],
  ) -> tuple[Tensor, Tensor]:
      """Embeds different types of prompts, returning both sparse and dense embeddings.
  
      Args:
          points: point coordinates and labels to embed.
          boxes: boxes to embed
          masks: masks to embed
  
      Returns:
          - sparse embeddings for the points and boxes, with shape BxNx(embed_dim), where N is determined by the
          number of input points and boxes.
          - dense embeddings for the masks, in the shape Bx(embed_dim)x(embed_H)x(embed_W)
      """
      bs = self._get_batch_size(points, boxes, masks)
      sparse_embeddings = torch.empty(
          (bs, 0, self.embed_dim), device=self._get_device()
      )
      if points is not None:
          coords, labels = points
          point_embeddings = self._embed_points(
              coords, labels, pad=(boxes is None)
          )
          sparse_embeddings = concatenate(
              [sparse_embeddings, point_embeddings], dim=1
          )
      if boxes is not None:
          box_embeddings = self._embed_boxes(boxes)
          sparse_embeddings = concatenate(
              [sparse_embeddings, box_embeddings], dim=1
          )
  
      if masks is not None:
          dense_embeddings = self._embed_masks(masks)
      else:
          dense_embeddings = self.no_mask_embed.weight.reshape(
              1, -1, 1, 1
          ).expand(
              bs,
              -1,
              self.image_embedding_size[0],
              self.image_embedding_size[1],
          )
  
      return sparse_embeddings, dense_embeddings
  
imports: from __future__ import annotations
  from math import pi
  from typing import Optional
  import torch
  from torch import nn
  from kornia.contrib.models.common import LayerNorm2d
  from kornia.core import Device, Module, Tensor, concatenate, cos, sin, stack, zeros
label_desc: Use image node_id 8 for calling the PromptEncoder obj's underlying member method code with example usage: obj.forward(points, boxes, masks) and returns: sparse_embeddings,  dense_embeddings