class_docstr: VanillaTransformer
  
  Vanilla Transformer, following implementation of the Informer paper, used as baseline.
  
  The architecture has three distinctive features:
  - Full-attention mechanism with O(L^2) time and memory complexity.
  - An MLP multi-step decoder that predicts long time-series sequences in a single forward operation rather than step-by-step.
  
  The Vanilla Transformer model utilizes a three-component approach to define its embedding:
  - It employs encoded autoregressive features obtained from a convolution network.
  - It uses window-relative positional embeddings derived from harmonic functions.
  - Absolute positional embeddings obtained from calendar features are utilized.
  
  *Parameters:*<br>
  `h`: int, forecast horizon.<br>
  `input_size`: int, maximum sequence length for truncated train backpropagation. Default -1 uses all history.<br>
  `futr_exog_list`: str list, future exogenous columns.<br>
  `hist_exog_list`: str list, historic exogenous columns.<br>
  `stat_exog_list`: str list, static exogenous columns.<br>
      `decoder_input_size_multiplier`: float = 0.5, .<br>
  `hidden_size`: int=128, units of embeddings and encoders.<br>
  `n_head`: int=4, controls number of multi-head's attention.<br>
  `dropout`: float (0, 1), dropout throughout Informer architecture.<br>
      `conv_hidden_size`: int=32, channels of the convolutional encoder.<br>
      `activation`: str=`GELU`, activation from ['ReLU', 'Softplus', 'Tanh', 'SELU', 'LeakyReLU', 'PReLU', 'Sigmoid', 'GELU'].<br>
  `encoder_layers`: int=2, number of layers for the TCN encoder.<br>
  `decoder_layers`: int=1, number of layers for the MLP decoder.<br>
  `loss`: PyTorch module, instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).<br>
  `max_steps`: int=1000, maximum number of training steps.<br>
  `learning_rate`: float=1e-3, Learning rate between (0, 1).<br>
  `num_lr_decays`: int=-1, Number of learning rate decays, evenly distributed across max_steps.<br>
  `early_stop_patience_steps`: int=-1, Number of validation iterations before early stopping.<br>
  `val_check_steps`: int=100, Number of training steps between every validation loss check.<br>
  `batch_size`: int=32, number of different series in each batch.<br>
  `valid_batch_size`: int=None, number of different series in each validation and test batch, if None uses batch_size.<br>
  `windows_batch_size`: int=1024, number of windows to sample in each training batch, default uses all.<br>
  `inference_windows_batch_size`: int=1024, number of windows to sample in each inference batch.<br>
  `start_padding_enabled`: bool=False, if True, the model will pad the time series with zeros at the beginning, by input size.<br>
  `scaler_type`: str='robust', type of scaler for temporal inputs normalization see [temporal scalers](https://nixtla.github.io/neuralforecast/common.scalers.html).<br>
  `random_seed`: int=1, random_seed for pytorch initializer and numpy generators.<br>
  `num_workers_loader`: int=os.cpu_count(), workers to be used by `TimeSeriesDataLoader`.<br>
  `drop_last_loader`: bool=False, if True `TimeSeriesDataLoader` drops last non-full batch.<br>
  `alias`: str, optional,  Custom name of the model.<br>
  `**trainer_kwargs`: int,  keyword trainer arguments inherited from [PyTorch Lighning's trainer](https://pytorch-lightning.readthedocs.io/en/stable/api/pytorch_lightning.trainer.trainer.Trainer.html?highlight=trainer).<br>
  
      *References*<br>
      - [Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, Wancai Zhang. "Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting"](https://arxiv.org/abs/2012.07436)<br>
class_docstr_tok: ["VanillaTransformer","Vanilla","Transformer",",","following","implementation","of","the","Informer","paper",",","used","as","baseline",".","The","architecture","has","three","distinctive","features",":","-","Full-attention","mechanism","with","O","(","L^2",")","time","and","memory","complexity",".","-","An","MLP","multi-step","decoder","that","predicts","long","time-series","sequences","in","a","single","forward","operation","rather","than","step-by-step",".","The","Vanilla","Transformer","model","utilizes","a","three-component","approach","to","define","its","embedding",":","-","It","employs","encoded","autoregressive","features","obtained","from","a","convolution","network",".","-","It","uses","window-relative","positional","embeddings","derived","from","harmonic","functions",".","-","Absolute","positional","embeddings","obtained","from","calendar","features","are","utilized",".","*","Parameters",":","*","<","br",">","`","h","`",":","int",",","forecast","horizon.","<","br",">","`","input_size","`",":","int",",","maximum","sequence","length","for","truncated","train","backpropagation",".","Default","-1","uses","all","history.","<","br",">","`","futr_exog_list","`",":","str","list",",","future","exogenous","columns.","<","br",">","`","hist_exog_list","`",":","str","list",",","historic","exogenous","columns.","<","br",">","`","stat_exog_list","`",":","str","list",",","static","exogenous","columns.","<","br",">","`","decoder_input_size_multiplier","`",":","float","=","0.5",",",".","<","br",">","`","hidden_size","`",":","int=128",",","units","of","embeddings","and","encoders.","<","br",">","`","n_head","`",":","int=4",",","controls","number","of","multi-head","'s","attention.","<","br",">","`","dropout","`",":","float","(","0",",","1",")",",","dropout","throughout","Informer","architecture.","<","br",">","`","conv_hidden_size","`",":","int=32",",","channels","of","the","convolutional","encoder.","<","br",">","`","activation","`",":","str=","`","GELU","`",",","activation","from","[","'ReLU","'",",","'Softplus","'",",","'Tanh","'",",","'SELU","'",",","'LeakyReLU","'",",","'PReLU","'",",","'Sigmoid","'",",","'GELU","'","]",".","<","br",">","`","encoder_layers","`",":","int=2",",","number","of","layers","for","the","TCN","encoder.","<","br",">","`","decoder_layers","`",":","int=1",",","number","of","layers","for","the","MLP","decoder.","<","br",">","`","loss","`",":","PyTorch","module",",","instantiated","train","loss","class","from","[","losses","collection","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/losses.pytorch.html",")",".","<","br",">","`","max_steps","`",":","int=1000",",","maximum","number","of","training","steps.","<","br",">","`","learning_rate","`",":","float=1e-3",",","Learning","rate","between","(","0",",","1",")",".","<","br",">","`","num_lr_decays","`",":","int=-1",",","Number","of","learning","rate","decays",",","evenly","distributed","across","max_steps.","<","br",">","`","early_stop_patience_steps","`",":","int=-1",",","Number","of","validation","iterations","before","early","stopping.","<","br",">","`","val_check_steps","`",":","int=100",",","Number","of","training","steps","between","every","validation","loss","check.","<","br",">","`","batch_size","`",":","int=32",",","number","of","different","series","in","each","batch.","<","br",">","`","valid_batch_size","`",":","int=None",",","number","of","different","series","in","each","validation","and","test","batch",",","if","None","uses","batch_size.","<","br",">","`","windows_batch_size","`",":","int=1024",",","number","of","windows","to","sample","in","each","training","batch",",","default","uses","all.","<","br",">","`","inference_windows_batch_size","`",":","int=1024",",","number","of","windows","to","sample","in","each","inference","batch.","<","br",">","`","start_padding_enabled","`",":","bool=False",",","if","True",",","the","model","will","pad","the","time","series","with","zeros","at","the","beginning",",","by","input","size.","<","br",">","`","scaler_type","`",":","str='robust","'",",","type","of","scaler","for","temporal","inputs","normalization","see","[","temporal","scalers","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/common.scalers.html",")",".","<","br",">","`","random_seed","`",":","int=1",",","random_seed","for","pytorch","initializer","and","numpy","generators.","<","br",">","`","num_workers_loader","`",":","int=os.cpu_count","(",")",",","workers","to","be","used","by","`","TimeSeriesDataLoader","`",".","<","br",">","`","drop_last_loader","`",":","bool=False",",","if","True","`","TimeSeriesDataLoader","`","drops","last","non-full","batch.","<","br",">","`","alias","`",":","str",",","optional",",","Custom","name","of","the","model.","<","br",">","`","*","*","trainer_kwargs","`",":","int",",","keyword","trainer","arguments","inherited","from","[","PyTorch","Lighning","'s","trainer","]","(","https",":","\/\/pytorch-lightning.readthedocs.io\/en\/stable\/api\/pytorch_lightning.trainer.trainer.Trainer.html","?","highlight=trainer",")",".","<","br",">","*","References","*","<","br",">","-","[","Haoyi","Zhou",",","Shanghang","Zhang",",","Jieqi","Peng",",","Shuai","Zhang",",","Jianxin","Li",",","Hui","Xiong",",","Wancai","Zhang",".","``","Informer",":","Beyond","Efficient","Transformer","for","Long","Sequence","Time-Series","Forecasting","''","]","(","https",":","\/\/arxiv.org\/abs\/2012.07436",")","<","br",">"]
code: def forward(self, windows_batch):
      # Parse windows_batch
      insample_y = windows_batch["insample_y"]
      # insample_mask = windows_batch['insample_mask']
      # hist_exog     = windows_batch['hist_exog']
      # stat_exog     = windows_batch['stat_exog']
  
      futr_exog = windows_batch["futr_exog"]
  
      insample_y = insample_y.unsqueeze(-1)  # [Ws,L,1]
  
      if self.futr_input_size > 0:
          x_mark_enc = futr_exog[:, : self.input_size, :]
          x_mark_dec = futr_exog[:, -(self.label_len + self.h) :, :]
      else:
          x_mark_enc = None
          x_mark_dec = None
  
      x_dec = torch.zeros(size=(len(insample_y), self.h, 1)).to(
          insample_y.device
      )
      x_dec = torch.cat(
          [insample_y[:, -self.label_len :, :], x_dec], dim=1
      )
  
      enc_out = self.enc_embedding(insample_y, x_mark_enc)
      enc_out, _ = self.encoder(
          enc_out, attn_mask=None
      )  # attns visualization
  
      dec_out = self.dec_embedding(x_dec, x_mark_dec)
      dec_out = self.decoder(
          dec_out, enc_out, x_mask=None, cross_mask=None
      )
  
      forecast = self.loss.domain_map(dec_out[:, -self.h :])
      return forecast
  
file_path: neuralforecast/neuralforecast/models/vanillatransformer.py
imports: import math
  import numpy
  from typing import Optional
  import torch
  import torch.nn
  from neuralforecast.common._modules import TransEncoderLayer, TransEncoder, TransDecoderLayer, TransDecoder, DataEmbedding, AttentionLayer
  from ..common._base_windows import BaseWindows
  from ..losses.pytorch import MAE
label_desc: Use image node_id 2 for calling the VanillaTransformer obj's underlying member method code with example usage: obj.forward(windows_batch) and returns: forecast