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 forward(self, src, src_mask, src_key_padding_mask, pos):
      q = k = self.with_pos_embed(src, pos)
      if src_key_padding_mask is not None:
          raise ValueError(
              "The multihead attention does not support key_padding mask, but got src_key_padding_mask is not None"
          )
  
      attn = self.self_attn(q, k, value=src, attn_mask=src_mask)[0]
      src += self.dropout(attn)
      src = self.norm1(src)
      attn = self.linear2(
          self.dropout(self.activation(self.linear1(src)))
      )
      src += self.dropout2(attn)
      src = self.norm2(src)
  
      return src
  
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 4 for calling the EncoderLayer obj's underlying member method code with example usage: obj.forward(src, src_mask, src_key_padding_mask, pos) and returns: src