code: def __init__(
      self,
      embed_dim,
      num_heads,
      num_layers,
      dropout,
      extract_layers,
      dim_linear_block,
  ):
      super().__init__()
      self.layer = nn.LayerList()
      self.extract_layers = extract_layers
  
      # makes TransformerBlock device aware
      self.block_list = nn.LayerList()
      for _ in range(num_layers):
          self.block_list.append(
              TransformerBlock(
                  dim=embed_dim,
                  heads=num_heads,
                  dim_linear_block=dim_linear_block,
                  dropout=dropout,
                  prenorm=True,
              )
          )
  
imports: from typing import List, Tuple
  import numpy
  import paddle
  import paddle.nn
  from paddle import Tensor
  from medicalseg.cvlibs import manager
label_desc: Use image node_id 1 to create a new TransformerEncoder object from inherited base classes: nn with example: obj = TransformerEncoder(embed_dim, num_heads, num_layers, dropout, extract_layers, dim_linear_block)