class_docstr: Transformer encoder
  Encoder encoder contains a list of EncoderLayer, and a LayerNorm.
  Attributes:
      layers: nn.LayerList contains multiple EncoderLayers
      encoder_norm: nn.LayerNorm which is applied after last encoder layer
code: def __init__(
      self,
      embed_dim,
      num_heads,
      depth,
      attn_head_size=None,
      qkv_bias=True,
      mlp_ratio=4.0,
      dropout=0.0,
      attention_dropout=0.0,
      droppath=0.0,
  ):
      super().__init__()
      # stochatic depth decay
      depth_decay = [
          x.item() for x in paddle.linspace(0, droppath, depth)
      ]
      layer_list = []
      for i in range(depth):
          encoder_layer = EncoderLayer(
              embed_dim,
              num_heads,
              attn_head_size=attn_head_size,
              qkv_bias=qkv_bias,
              mlp_ratio=mlp_ratio,
              dropout=dropout,
              attention_dropout=attention_dropout,
              droppath=depth_decay[i],
          )
          layer_list.append(copy.deepcopy(encoder_layer))
      self.layers = nn.LayerList(layer_list)
  
      w_attr_1, b_attr_1 = self._init_weights()
      self.encoder_norm = nn.LayerNorm(
          embed_dim,
          weight_attr=w_attr_1,
          bias_attr=b_attr_1,
          epsilon=1e-6,
      )
  
imports: import copy
  import paddle
  import paddle.nn
  from disco_diffusion_ernievil_base.vit_b_16x.ernievil2.transformers.droppath import DropPath
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: nn with example: obj = Encoder(embed_dim, num_heads, depth, attn_head_size, qkv_bias, mlp_ratio, dropout, attention_dropout, droppath)