class_docstr: The transformer encoder.
  
  Args:
      encoder_layer(nn.Layer): The base layer to compose the encoder.
      num_layers(int): How many layers is used in the encoder.
      norm(str): the kind of normalization that used before output.
class_docstr_tok: ["The","transformer","encoder",".","Args",":","encoder_layer","(","nn.Layer",")",":","The","base","layer","to","compose","the","encoder",".","num_layers","(","int",")",":","How","many","layers","is","used","in","the","encoder",".","norm","(","str",")",":","the","kind","of","normalization","that","used","before","output","."]
code: def forward(
      self, src, mask=None, src_key_padding_mask=None, pos=None
  ):
      output = src
  
      for layer in self.layers:
          # if pos is not none, all the encoder layer will have the position embedding
          output = layer(
              output,
              src_mask=mask,
              src_key_padding_mask=src_key_padding_mask,
              pos=pos,
          )
  
      if self.norm is not None:
          output = self.norm(output)
  
      return output
  
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 2 for calling the TransformerEncoder obj's underlying member method code with example usage: obj.forward(src, mask, src_key_padding_mask, pos) and returns: output