class_docstr: Transformer for time series forecasting.
  Code adapted from https://github.com/thuml/Autoformer.
docstr: :param n_past: # of past steps used for forecasting future.
  :param max_forecast_steps:  Max # of steps we would like to forecast for.
  :param encoder_input_size: Input size of encoder. If ``encoder_input_size = None``,
      then the model will automatically use ``config.dim``,  which is the dimension of the input data.
  :param decoder_input_size: Input size of decoder. If ``decoder_input_size = None``,
      then the model will automatically use ``config.dim``, which is the dimension of the input data.
  :param num_encoder_layers: Number of encoder layers.
  :param num_decoder_layers: Number of decoder layers.
  :param start_token_len: Length of start token for deep transformer encoder-decoder based models.
      The start token is similar to the special tokens for NLP models (e.g., bos, sep, eos tokens).
  :param factor: Attention factor.
  :param model_dim: Dimension of the model.
  :param embed: Time feature encoding type, options include ``timeF``, ``fixed`` and ``learned``.
  :param dropout: dropout rate.
  :param activation: Activation function, can be ``gelu``, ``relu``, ``sigmoid``, etc.
  :param n_heads: Number of heads of the model.
  :param fcn_dim: Hidden dimension of the MLP layer in the model.
  :param distil: whether to use distilling in the encoder of the model.
docstr_tok: [":","param","n_past",":","#","of","past","steps","used","for","forecasting","future",".",":","param","max_forecast_steps",":","Max","#","of","steps","we","would","like","to","forecast","for",".",":","param","encoder_input_size",":","Input","size","of","encoder",".","If","``","encoder_input_size","=","None","``",",","then","the","model","will","automatically","use","``","config.dim","``",",","which","is","the","dimension","of","the","input","data",".",":","param","decoder_input_size",":","Input","size","of","decoder",".","If","``","decoder_input_size","=","None","``",",","then","the","model","will","automatically","use","``","config.dim","``",",","which","is","the","dimension","of","the","input","data",".",":","param","num_encoder_layers",":","Number","of","encoder","layers",".",":","param","num_decoder_layers",":","Number","of","decoder","layers",".",":","param","start_token_len",":","Length","of","start","token","for","deep","transformer","encoder-decoder","based","models",".","The","start","token","is","similar","to","the","special","tokens","for","NLP","models","(","e.g.",",","bos",",","sep",",","eos","tokens",")",".",":","param","factor",":","Attention","factor",".",":","param","model_dim",":","Dimension","of","the","model",".",":","param","embed",":","Time","feature","encoding","type",",","options","include","``","timeF","``",",","``","fixed","``","and","``","learned","``",".",":","param","dropout",":","dropout","rate",".",":","param","activation",":","Activation","function",",","can","be","``","gelu","``",",","``","relu","``",",","``","sigmoid","``",",","etc",".",":","param","n_heads",":","Number","of","heads","of","the","model",".",":","param","fcn_dim",":","Hidden","dimension","of","the","MLP","layer","in","the","model",".",":","param","distil",":","whether","to","use","distilling","in","the","encoder","of","the","model","."]
code: def __init__(
      self,
      n_past,
      max_forecast_steps: int = None,
      encoder_input_size: int = None,
      decoder_input_size: int = None,
      num_encoder_layers: int = 2,
      num_decoder_layers: int = 1,
      start_token_len: int = 0,
      factor: int = 3,
      model_dim: int = 512,
      embed: str = "timeF",
      dropout: float = 0.05,
      activation: str = "gelu",
      n_heads: int = 8,
      fcn_dim: int = 2048,
      distil: bool = True,
      **kwargs,
  ):
      """
      :param n_past: # of past steps used for forecasting future.
      :param max_forecast_steps:  Max # of steps we would like to forecast for.
      :param encoder_input_size: Input size of encoder. If ``encoder_input_size = None``,
          then the model will automatically use ``config.dim``,  which is the dimension of the input data.
      :param decoder_input_size: Input size of decoder. If ``decoder_input_size = None``,
          then the model will automatically use ``config.dim``, which is the dimension of the input data.
      :param num_encoder_layers: Number of encoder layers.
      :param num_decoder_layers: Number of decoder layers.
      :param start_token_len: Length of start token for deep transformer encoder-decoder based models.
          The start token is similar to the special tokens for NLP models (e.g., bos, sep, eos tokens).
      :param factor: Attention factor.
      :param model_dim: Dimension of the model.
      :param embed: Time feature encoding type, options include ``timeF``, ``fixed`` and ``learned``.
      :param dropout: dropout rate.
      :param activation: Activation function, can be ``gelu``, ``relu``, ``sigmoid``, etc.
      :param n_heads: Number of heads of the model.
      :param fcn_dim: Hidden dimension of the MLP layer in the model.
      :param distil: whether to use distilling in the encoder of the model.
      """
  
      super().__init__(
          n_past=n_past, max_forecast_steps=max_forecast_steps, **kwargs
      )
  
imports: import copy
  import logging
  import math
  import numpy
  import pandas
  from scipy.stats import norm
  from typing import List, Optional, Tuple, Union
  from abc import abstractmethod
  from merlion.models.base import NormalizingConfig
  from merlion.models.deep_base import TorchModel
  from merlion.models.forecast.deep_base import DeepForecasterConfig, DeepForecaster
  from merlion.models.utils.nn_modules import FullAttention, AttentionLayer, DataEmbedding, ConvLayer
  from merlion.models.utils.nn_modules.enc_dec_transformer import Encoder, EncoderLayer, Decoder, DecoderLayer
  from merlion.utils.misc import initializer
label_desc: Use image node_id 1 to create a new TransformerConfig object from inherited base classes: DeepForecasterConfig, NormalizingConfig with example: obj = TransformerConfig(n_past, max_forecast_steps, encoder_input_size, decoder_input_size, num_encoder_layers, num_decoder_layers, start_token_len, factor, model_dim, embed, dropout, activation, n_heads, fcn_dim, distil)