code: def __init__(
      self,
      dim,
      num_heads,
      mlp_ratio=4.0,
      qkv_bias=False,
      attn_bias=False,
      qk_scale=None,
      init_values=None,
      drop=0.0,
      attn_drop=0.0,
      drop_path=0.0,
      use_rel_pos=True,
      rel_pos_zero_init=True,
      window_size=None,
      input_size=None,
      act_layer="nn.GELU",
      norm_layer="nn.LayerNorm",
      lr_factor=1.0,
      epsilon=1e-5,
  ):
      super().__init__()
      self.window_size = window_size
  
      self.norm1 = eval(norm_layer)(
          dim,
          weight_attr=ParamAttr(
              learning_rate=lr_factor, regularizer=L2Decay(0.0)
          ),
          bias_attr=ParamAttr(
              learning_rate=lr_factor, regularizer=L2Decay(0.0)
          ),
          epsilon=epsilon,
      )
      self.attn = Attention(
          dim,
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          attn_bias=attn_bias,
          qk_scale=qk_scale,
          attn_drop=attn_drop,
          proj_drop=drop,
          use_rel_pos=use_rel_pos,
          rel_pos_zero_init=rel_pos_zero_init,
          window_size=window_size,
          input_size=input_size,
          lr_factor=lr_factor,
      )
  
      self.drop_path = (
          DropPath(drop_path) if drop_path > 0.0 else Identity()
      )
      self.norm2 = eval(norm_layer)(
          dim,
          weight_attr=ParamAttr(
              learning_rate=lr_factor, regularizer=L2Decay(0.0)
          ),
          bias_attr=ParamAttr(
              learning_rate=lr_factor, regularizer=L2Decay(0.0)
          ),
          epsilon=epsilon,
      )
      self.mlp = Mlp(
          in_features=dim,
          hidden_features=int(dim * mlp_ratio),
          act_layer=act_layer,
          drop=drop,
          lr_factor=lr_factor,
      )
      if init_values is not None:
          self.gamma_1 = self.create_parameter(
              shape=([dim]),
              default_initializer=Constant(value=init_values),
          )
          self.gamma_2 = self.create_parameter(
              shape=([dim]),
              default_initializer=Constant(value=init_values),
          )
      else:
          self.gamma_1, self.gamma_2 = None, None
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  import numpy
  import math
  from paddle import ParamAttr
  from paddle.regularizer import L2Decay
  from paddle.nn.initializer import Constant, TruncatedNormal
  from ppdet.modeling.shape_spec import ShapeSpec
  from ppdet.core.workspace import register, serializable
  from .transformer_utils import zeros_, DropPath, Identity, window_partition, window_unpartition
  from ..initializer import linear_init_
label_desc: Use image node_id 1 to create a new Block object from inherited base classes: nn with example: obj = Block(dim, num_heads, mlp_ratio, qkv_bias, attn_bias, qk_scale, init_values, drop, attn_drop, drop_path, use_rel_pos, rel_pos_zero_init, window_size, input_size, act_layer, norm_layer, lr_factor, epsilon)