code: def __init__(
      self, encoder_length: int, config: Dict, **kwargs
  ) -> None:
      super().__init__(**kwargs)
  
      self.encoder_length = encoder_length
  
      with self.name_scope():
          self.enc_input_layer = InputLayer(
              model_size=config["model_dim"]
          )
  
          self.enc_pre_self_att = TransformerProcessBlock(
              sequence=config["pre_seq"],
              dropout=config["dropout_rate"],
              prefix="pretransformerprocessblock_",
          )
          self.enc_self_att = MultiHeadSelfAttention(
              att_dim_in=config["model_dim"],
              heads=config["num_heads"],
              att_dim_out=config["model_dim"],
              dropout=config["dropout_rate"],
              prefix="multiheadselfattention_",
          )
          self.enc_post_self_att = TransformerProcessBlock(
              sequence=config["post_seq"],
              dropout=config["dropout_rate"],
              prefix="postselfatttransformerprocessblock_",
          )
          self.enc_ff = TransformerFeedForward(
              inner_dim=config["model_dim"]
              * config["inner_ff_dim_scale"],
              out_dim=config["model_dim"],
              act_type=config["act_type"],
              dropout=config["dropout_rate"],
              prefix="transformerfeedforward_",
          )
          self.enc_post_ff = TransformerProcessBlock(
              sequence=config["post_seq"],
              dropout=config["dropout_rate"],
              prefix="postfftransformerprocessblock_",
          )
  
file_path: gluonts/src/gluonts/mx/model/transformer/trans_encoder.py
imports: from typing import Dict
  from mxnet.gluon import HybridBlock
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
  from .layers import InputLayer, MultiHeadSelfAttention, TransformerFeedForward, TransformerProcessBlock
label_desc: Use image node_id 1 to create a new TransformerEncoder object from inherited base classes: HybridBlock with example: obj = TransformerEncoder(encoder_length, config)