code: def build_encoder_layer(self, args):
      if args.use_torch_layer:
          from lightseq.training.ops.pytorch import (
              TransformerEncoderLayer,
          )
      else:
          from lightseq.training.ops.pytorch.transformer_encoder_layer import (
              LSTransformerEncoderLayer as TransformerEncoderLayer,
          )
  
      config = TransformerEncoderLayer.get_config(
          max_batch_tokens=args.max_tokens,
          max_seq_len=args.max_source_positions,
          hidden_size=args.encoder_embed_dim,
          intermediate_size=args.encoder_ffn_embed_dim,
          nhead=args.encoder_attention_heads,
          attn_prob_dropout_ratio=args.attention_dropout,
          activation_dropout_ratio=args.activation_dropout,
          hidden_dropout_ratio=args.dropout,
          pre_layer_norm=args.encoder_normalize_before,
          fp16=args.fp16,
          local_rank=args.device_id,
          activation_fn=args.activation_fn,
      )
  
      return TransformerEncoderLayer(config)
  
imports: import torch
  import torch.nn
  from fairseq import utils
  from fairseq.models import FairseqEncoder, FairseqEncoderDecoderModel, FairseqIncrementalDecoder, register_model, register_model_architecture
  from fairseq.models.fairseq_encoder import EncoderOut
  from fairseq.modules import LayerNorm
  from lightseq.training.ops.pytorch.layer_base import TransformerEmbeddingLayerBase
  from lightseq.training.ops.pytorch.quantization import QuantLinear, disable_quant, enable_quant, ptq_mode, qat_mode
label_desc: Use image node_id 2 for calling the LSTransformerEncoder obj's underlying member method code with example usage: obj.build_encoder_layer(args) and returns: TransformerEncoderLayer