class_docstr: encoder
class_docstr_tok: ["encoder"]
code: def __init__(
      self,
      n_layer,
      n_head,
      d_key,
      d_value,
      d_model,
      d_inner_hid,
      prepostprocess_dropout,
      attention_dropout,
      relu_dropout,
      preprocess_cmd="n",
      postprocess_cmd="da",
  ):
      super(Encoder, self).__init__()
  
      self.encoder_layers = list()
      for i in range(n_layer):
          self.encoder_layers.append(
              self.add_sublayer(
                  "layer_%d" % i,
                  EncoderLayer(
                      n_head,
                      d_key,
                      d_value,
                      d_model,
                      d_inner_hid,
                      prepostprocess_dropout,
                      attention_dropout,
                      relu_dropout,
                      preprocess_cmd,
                      postprocess_cmd,
                  ),
              )
          )
      self.processer = PrePostProcessLayer(
          preprocess_cmd, d_model, prepostprocess_dropout
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  from paddle import ParamAttr, nn
  from paddle import nn, ParamAttr
  from paddle.nn import functional
  import numpy
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: nn with example: obj = Encoder(n_layer, n_head, d_key, d_value, d_model, d_inner_hid, prepostprocess_dropout, attention_dropout, relu_dropout, preprocess_cmd, postprocess_cmd)