class_docstr: Construct the embeddings from patch, position embeddings.
      
class_docstr_tok: ["Construct","the","embeddings","from","patch",",","position","embeddings","."]
code: def __init__(
      self, hybrid_model, grid_size, hidden_size, dropout_rate, img_size
  ):
      super(Embeddings, self).__init__()
  
      img_size = (img_size, img_size)
  
      patch_size = (
          img_size[0] // 16 // grid_size[0],
          img_size[1] // 16 // grid_size[1],
      )
      patch_size_real = (patch_size[0] * 16, patch_size[1] * 16)
      n_patches = (img_size[0] // patch_size_real[0]) * (
          img_size[1] // patch_size_real[1]
      )
  
      self.hybrid_model = hybrid_model
      in_channels = self.hybrid_model.width * 16
      self.patch_embeddings = nn.Conv2D(
          in_channels=in_channels,
          out_channels=hidden_size,
          kernel_size=patch_size,
          stride=patch_size,
      )
      self.position_embeddings = paddle.create_parameter(
          shape=[1, n_patches, hidden_size],
          dtype="float32",
          default_initializer=nn.initializer.Constant(0),
      )
  
      self.dropout = nn.Dropout(dropout_rate)
      self.hybrid = True
  
imports: import copy
  import math
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from medicalseg.cvlibs import manager
  from medicalseg.utils import load_pretrained_model
label_desc: Use image node_id 1 to create a new Embeddings object from inherited base classes: nn with example: obj = Embeddings(hybrid_model, grid_size, hidden_size, dropout_rate, img_size)