code: def __init__(
      self,
      num_hidden_layers,
      hidden_size,
      intermediate_size,
      num_attention_heads,
      attention_probs_dropout_prob,
      fc_dropout_prob,
      act_fn="ReLU",
      output_attentions=False,
      output_hidden_feats=False,
  ):
      super(BertEncoder, self).__init__()
      self.output_attentions = output_attentions
      self.output_hidden_feats = output_hidden_feats
      self.layers = nn.LayerList(
          [
              BertLayer(
                  hidden_size,
                  intermediate_size,
                  num_attention_heads,
                  attention_probs_dropout_prob,
                  fc_dropout_prob,
                  act_fn,
                  output_attentions,
              )
              for _ in range(num_hidden_layers)
          ]
      )
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle.nn import ReLU, Swish, GELU
  import math
  from ppdet.core.workspace import register
  from ..shape_spec import ShapeSpec
label_desc: Use image node_id 1 to create a new BertEncoder object from inherited base classes: nn with example: obj = BertEncoder(num_hidden_layers, hidden_size, intermediate_size, num_attention_heads, attention_probs_dropout_prob, fc_dropout_prob, act_fn, output_attentions, output_hidden_feats)