class_docstr: Vision Transformer with support for patch input
      
class_docstr_tok: ["Vision","Transformer","with","support","for","patch","input"]
code: def __init__(
      self,
      img_size=[672, 1092],
      patch_size=16,
      in_chans=3,
      embed_dim=768,
      depth=12,
      num_heads=12,
      mlp_ratio=4,
      qkv_bias=False,
      qk_scale=None,
      drop_rate=0.0,
      attn_drop_rate=0.0,
      drop_path_rate=0.0,
      norm_layer="nn.LayerNorm",
      init_values=None,
      use_rel_pos_bias=False,
      use_shared_rel_pos_bias=False,
      epsilon=1e-5,
      final_norm=False,
      pretrained=None,
      out_indices=[3, 5, 7, 11],
      use_abs_pos_emb=False,
      use_sincos_pos_emb=True,
      with_fpn=True,
      num_fpn_levels=4,
      use_checkpoint=False,
      **args,
  ):
      super().__init__()
      self.img_size = img_size
      self.embed_dim = embed_dim
      self.with_fpn = with_fpn
      self.use_checkpoint = use_checkpoint
      self.use_sincos_pos_emb = use_sincos_pos_emb
      self.use_rel_pos_bias = use_rel_pos_bias
      self.final_norm = final_norm
      self.out_indices = out_indices
      self.num_fpn_levels = num_fpn_levels
  
      if use_checkpoint:
          paddle.seed(0)
  
      self.patch_embed = PatchEmbed(
          img_size=img_size,
          patch_size=patch_size,
          in_chans=in_chans,
          embed_dim=embed_dim,
      )
  
      self.pos_w = self.patch_embed.num_patches_in_w
      self.pos_h = self.patch_embed.num_patches_in_h
  
      self.cls_token = self.create_parameter(
          shape=(1, 1, embed_dim),
          default_initializer=paddle.nn.initializer.Constant(value=0.0),
      )
  
      if use_abs_pos_emb:
          self.pos_embed = self.create_parameter(
              shape=(1, self.pos_w * self.pos_h + 1, embed_dim),
              default_initializer=paddle.nn.initializer.TruncatedNormal(
                  std=0.02
              ),
          )
      elif use_sincos_pos_emb:
          pos_embed = self.build_2d_sincos_position_embedding(embed_dim)
  
          self.pos_embed = pos_embed
          self.pos_embed = self.create_parameter(shape=pos_embed.shape)
          self.pos_embed.set_value(pos_embed.numpy())
          self.pos_embed.stop_gradient = True
  
      else:
          self.pos_embed = None
  
      self.pos_drop = nn.Dropout(p=drop_rate)
  
      if use_shared_rel_pos_bias:
          self.rel_pos_bias = RelativePositionBias(
              window_size=self.patch_embed.patch_shape,
              num_heads=num_heads,
          )
      else:
          self.rel_pos_bias = None
  
      dpr = np.linspace(0, drop_path_rate, depth)
  
      self.blocks = nn.LayerList(
          [
              Block(
                  dim=embed_dim,
                  num_heads=num_heads,
                  mlp_ratio=mlp_ratio,
                  qkv_bias=qkv_bias,
                  qk_scale=qk_scale,
                  drop=drop_rate,
                  attn_drop=attn_drop_rate,
                  drop_path=dpr[i],
                  norm_layer=norm_layer,
                  init_values=init_values,
                  window_size=self.patch_embed.patch_shape
                  if use_rel_pos_bias
                  else None,
                  epsilon=epsilon,
              )
              for i in range(depth)
          ]
      )
  
      self.pretrained = pretrained
      self.init_weight()
  
      assert len(out_indices) <= 4, ""
      self.out_indices = out_indices
      self.out_channels = [embed_dim for _ in range(num_fpn_levels)]
      self.out_strides = (
          [4, 8, 16, 32][-num_fpn_levels:]
          if with_fpn
          else [patch_size for _ in range(len(out_indices))]
      )
  
      self.norm = Identity()
  
      if self.with_fpn:
          assert num_fpn_levels <= 4, ""
          self.init_fpn(
              embed_dim=embed_dim,
              patch_size=patch_size,
          )
  
imports: import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import numpy
  from paddle.nn.initializer import Constant
  from ppdet.modeling.shape_spec import ShapeSpec
  from ppdet.core.workspace import register, serializable
  from .transformer_utils import zeros_, DropPath, Identity
label_desc: Use image node_id 1 to create a new VisionTransformer object from inherited base classes: nn with example: obj = VisionTransformer(img_size, patch_size, in_chans, embed_dim, depth, num_heads, mlp_ratio, qkv_bias, qk_scale, drop_rate, attn_drop_rate, drop_path_rate, norm_layer, init_values, use_rel_pos_bias, use_shared_rel_pos_bias, epsilon, final_norm, pretrained, out_indices, use_abs_pos_emb, use_sincos_pos_emb, with_fpn, num_fpn_levels, use_checkpoint)