code: def __init__(
      self,
      encoder: TransformerEncoder,
      decoder: TransformerDecoder,
      history_length: int,
      context_length: int,
      prediction_length: int,
      distr_output: DistributionOutput,
      cardinality: List[int],
      embedding_dimension: int,
      lags_seq: List[int],
      scaling: bool = True,
      **kwargs,
  ) -> None:
      super().__init__(**kwargs)
  
      self.history_length = history_length
      self.context_length = context_length
      self.prediction_length = prediction_length
      self.scaling = scaling
      self.cardinality = cardinality
      self.embedding_dimension = embedding_dimension
      self.distr_output = distr_output
  
      assert len(set(lags_seq)) == len(
          lags_seq
      ), "no duplicated lags allowed!"
      lags_seq.sort()
  
      self.lags_seq = lags_seq
  
      self.target_shape = distr_output.event_shape
  
      with self.name_scope():
          self.proj_dist_args = distr_output.get_args_proj()
          self.encoder = encoder
          self.decoder = decoder
          self.embedder = FeatureEmbedder(
              cardinalities=cardinality,
              embedding_dims=[embedding_dimension for _ in cardinality],
          )
  
          if scaling:
              self.scaler = MeanScaler(keepdims=True)
          else:
              self.scaler = NOPScaler(keepdims=True)
  
imports: from typing import List, Optional, Tuple
  import mxnet
  from gluonts.core.component import validated
  from gluonts.itertools import prod
  from gluonts.mx import Tensor
  from gluonts.mx.block.feature import FeatureEmbedder
  from gluonts.mx.block.scaler import MeanScaler, NOPScaler
  from gluonts.mx.distribution import DistributionOutput
  from gluonts.mx.util import weighted_average
  from .trans_decoder import TransformerDecoder
  from .trans_encoder import TransformerEncoder
label_desc: Use image node_id 1 to create a new TransformerNetwork object from inherited base classes: mx.gluon with example: obj = TransformerNetwork(encoder, decoder, history_length, context_length, prediction_length, distr_output, cardinality, embedding_dimension, lags_seq, scaling)