code: def __init__(
      self,
      units: int = 512,
      hidden_size: int = 2048,
      num_layers: int = 6,
      num_heads: int = 8,
      attention_dropout_prob: float = 0.0,
      hidden_dropout_prob: float = 0.0,
      output_attention: bool = False,
      dtype="float32",
      output_all_encodings: bool = False,
      layer_norm_eps: float = 1e-12,
      weight_initializer: InitializerType = TruncNorm(stdev=0.02),
      bias_initializer: InitializerType = "zeros",
      activation="gelu",
      layout="NT",
  ):
      super().__init__()
      assert units % num_heads == 0, (
          "In BertTransformer, The units should be divided exactly "
          "by the number of heads. Received units={}, num_heads={}".format(
              units, num_heads
          )
      )
  
      self._dtype = dtype
      self._num_layers = num_layers
      self._output_attention = output_attention
      self._output_all_encodings = output_all_encodings
      self._layout = layout
  
      self.all_layers = nn.HybridSequential()
      for layer_idx in range(num_layers):
          self.all_layers.add(
              TransformerEncoderLayer(
                  units=units,
                  hidden_size=hidden_size,
                  num_heads=num_heads,
                  attention_dropout_prob=attention_dropout_prob,
                  hidden_dropout_prob=hidden_dropout_prob,
                  layer_norm_eps=layer_norm_eps,
                  weight_initializer=weight_initializer,
                  bias_initializer=bias_initializer,
                  activation=activation,
                  layout=layout,
                  dtype=dtype,
              )
          )
  
imports: import os
  from typing import Tuple
  import mxnet
  from mxnet import use_np, np, npx
  from mxnet.gluon import HybridBlock, nn
  from .base import BACKBONE_REGISTRY
  from .transformer import TransformerEncoderLayer
  from ..base import get_model_zoo_home_dir, get_repo_model_zoo_url, get_model_zoo_checksum_dir
  from ..utils.config import CfgNode
  from ..utils.misc import load_checksum_stats, download
  from ..utils.registry import Registry
  from ..initializer import TruncNorm
  from ..attention_cell import MultiHeadAttentionCell, gen_self_attn_mask
  from ..layers import get_activation, PositionalEmbedding, PositionwiseFFN, InitializerType
  from ..op import select_vectors_by_position
  from ..data.tokenizers import HuggingFaceWordPieceTokenizer
label_desc: Use image node_id 1 to create a new BertTransformer object from inherited base classes: HybridBlock with example: obj = BertTransformer(units, hidden_size, num_layers, num_heads, attention_dropout_prob, hidden_dropout_prob, output_attention, dtype, output_all_encodings, layer_norm_eps, weight_initializer, bias_initializer, activation, layout)