code: def get_test_bert_encoder(num_layers):
      def ls_generate_bert_enc_layer(
          initial_weights=None, initial_biases=None
      ):
          config = LSTransformerEncoderLayer.get_config(
              max_batch_tokens=max_batch_tokens,
              max_seq_len=max_seq_len,
              hidden_size=1024,
              intermediate_size=4096,
              nhead=16,
              attn_prob_dropout_ratio=0.0,
              activation_dropout_ratio=0.0,
              hidden_dropout_ratio=0.0,
              pre_layer_norm=False,
              fp16=True,
              local_rank=0,
              activation_fn="gelu",
          )
          layer = LSTransformerEncoderLayer(
              config, initial_weights, initial_biases
          )
          layer.to(torch.device("cuda:0"), dtype=torch.half)
          return layer
  
      def gen_bert_enc_layer_pair():
          fairseq_enc_layer = fairseq_layers.generate_bert_enc_layer()
          fairseq_enc_layer.train()
          (
              initial_enc_weights,
              initial_enc_biases,
          ) = get_fairseq_enc_params(fairseq_enc_layer)
          custom_enc_layer = ls_generate_bert_enc_layer(
              initial_enc_weights, initial_enc_biases
          )
          custom_enc_layer.train()
          return fairseq_enc_layer, custom_enc_layer
  
      custom_bert_enc_layer_list = []
      fairseq_bert_enc_layer_list = []
      for _ in range(num_layers):
          (
              fairseq_enc_layer,
              custom_enc_layer,
          ) = gen_bert_enc_layer_pair()
          custom_bert_enc_layer_list.append(custom_enc_layer)
          fairseq_bert_enc_layer_list.append(fairseq_enc_layer)
  
      return custom_bert_enc_layer_list, fairseq_bert_enc_layer_list
  
imports: import random
  import math
  from copy import deepcopy
  from dataclasses import dataclass
  import torch
  import torch.nn
  from tests.util import TestDecorator, get_fairseq_enc_params, get_fairseq_dec_params, max_batch_tokens, max_seq_len, split_custom_layer_grad, copy_grad_from_paras, copy_cmax_grad_from_paras
  from tests import fairseq_layers
  from lightseq.training.ops.pytorch.transformer_encoder_layer import LSTransformerEncoderLayer
  from lightseq.training.ops.pytorch.transformer_embedding_layer import LSTransformerEmbeddingLayer
  from lightseq.training.ops.pytorch.cross_entropy_layer import LSCrossEntropyLayer
  from lightseq.training.ops.pytorch.quant_linear_layer import LSQuantLinearLayer
  from lightseq.training.cli.fs_modules.ls_fs_transformer_decoder_layer import LSFSTransformerDecoderLayer
  from lightseq.training.ops.pytorch.quantization import enable_quant, disable_quant, qat_mode, ptq_mode
label_desc: Use image node_id 3 for calling a global function with example usage: get_test_bert_encoder(num_layers) and returns: custom_bert_enc_layer_list,  fairseq_bert_enc_layer_list, layer, fairseq_enc_layer,  custom_enc_layer