class_docstr: The layer to compose the transformer encoder.
  
  Args:
      d_model(int): The input feature's channels.
      nhead(int): the number of head for MHSA.
      dim_feedforward(int): The internal channels of linear layer.
      dropout(int): the dropout probability.
      activation(str): the kind of activation that used.
class_docstr_tok: ["The","layer","to","compose","the","transformer","encoder",".","Args",":","d_model","(","int",")",":","The","input","feature","'s","channels",".","nhead","(","int",")",":","the","number","of","head","for","MHSA",".","dim_feedforward","(","int",")",":","The","internal","channels","of","linear","layer",".","dropout","(","int",")",":","the","dropout","probability",".","activation","(","str",")",":","the","kind","of","activation","that","used","."]
code: def __init__(
      self,
      d_model,
      nhead,
      dim_feedforward=2048,
      dropout=0.1,
      activation="relu",
  ):
      super().__init__()
  
      self.self_attn = nn.MultiHeadAttention(d_model, nhead, dropout)
  
      self.linear1 = nn.Linear(d_model, dim_feedforward)
      self.dropout = nn.Dropout(dropout)
      self.linear2 = nn.Linear(dim_feedforward, d_model)
  
      self.norm1 = nn.LayerNorm(d_model)
      self.norm2 = nn.LayerNorm(d_model)
      self.dropout1 = nn.Dropout(dropout)
      self.dropout2 = nn.Dropout(dropout)
  
      self.activation = nn.ReLU()
      self.init_weight()
  
imports: import math
  import copy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.models import layers
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.utils import utils
  from paddleseg.core.train import check_logits_losses
label_desc: Use image node_id 1 to create a new EncoderLayer object from inherited base classes: nn with example: obj = EncoderLayer(d_model, nhead, dim_feedforward, dropout, activation)