class_docstr: DilatedRNN
  
  **Parameters:**<br>
  `h`: int, forecast horizon.<br>
  `input_size`: int, maximum sequence length for truncated train backpropagation. Default -1 uses all history.<br>
  `inference_input_size`: int, maximum sequence length for truncated inference. Default -1 uses all history.<br>
  `cell_type`: str, type of RNN cell to use. Options: 'GRU', 'RNN', 'LSTM', 'ResLSTM', 'AttentiveLSTM'.<br>
  `dilations`: int list, dilations betweem layers.<br>
  `encoder_hidden_size`: int=200, units for the RNN's hidden state size.<br>
  `context_size`: int=10, size of context vector for each timestamp on the forecasting window.<br>
  `decoder_hidden_size`: int=200, size of hidden layer for the MLP decoder.<br>
  `decoder_layers`: int=2, number of layers for the MLP decoder.<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>
  `loss`: PyTorch module, instantiated train loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).<br>
  `valid_loss`: PyTorch module=`loss`, instantiated valid loss class from [losses collection](https://nixtla.github.io/neuralforecast/losses.pytorch.html).<br>
  `max_steps`: int, maximum number of training steps.<br>
  `learning_rate`: float, Learning rate between (0, 1).<br>
  `num_lr_decays`: int, Number of learning rate decays, evenly distributed across max_steps.<br>
  `early_stop_patience_steps`: int, Number of validation iterations before early stopping.<br>
  `val_check_steps`: int, 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.<br>
  `step_size`: int=1, step size between each window of temporal data.<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>
class_docstr_tok: ["DilatedRNN","*","*","Parameters",":","*","*","<","br",">","`","h","`",":","int",",","forecast","horizon.","<","br",">","`","input_size","`",":","int",",","maximum","sequence","length","for","truncated","train","backpropagation",".","Default","-1","uses","all","history.","<","br",">","`","inference_input_size","`",":","int",",","maximum","sequence","length","for","truncated","inference",".","Default","-1","uses","all","history.","<","br",">","`","cell_type","`",":","str",",","type","of","RNN","cell","to","use",".","Options",":","'GRU","'",",","'RNN","'",",","'LSTM","'",",","'ResLSTM","'",",","'AttentiveLSTM'.","<","br",">","`","dilations","`",":","int","list",",","dilations","betweem","layers.","<","br",">","`","encoder_hidden_size","`",":","int=200",",","units","for","the","RNN","'s","hidden","state","size.","<","br",">","`","context_size","`",":","int=10",",","size","of","context","vector","for","each","timestamp","on","the","forecasting","window.","<","br",">","`","decoder_hidden_size","`",":","int=200",",","size","of","hidden","layer","for","the","MLP","decoder.","<","br",">","`","decoder_layers","`",":","int=2",",","number","of","layers","for","the","MLP","decoder.","<","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",">","`","loss","`",":","PyTorch","module",",","instantiated","train","loss","class","from","[","losses","collection","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/losses.pytorch.html",")",".","<","br",">","`","valid_loss","`",":","PyTorch","module=","`","loss","`",",","instantiated","valid","loss","class","from","[","losses","collection","]","(","https",":","\/\/nixtla.github.io\/neuralforecast\/losses.pytorch.html",")",".","<","br",">","`","max_steps","`",":","int",",","maximum","number","of","training","steps.","<","br",">","`","learning_rate","`",":","float",",","Learning","rate","between","(","0",",","1",")",".","<","br",">","`","num_lr_decays","`",":","int",",","Number","of","learning","rate","decays",",","evenly","distributed","across","max_steps.","<","br",">","`","early_stop_patience_steps","`",":","int",",","Number","of","validation","iterations","before","early","stopping.","<","br",">","`","val_check_steps","`",":","int",",","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.","<","br",">","`","step_size","`",":","int=1",",","step","size","between","each","window","of","temporal","data.","<","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",">"]
code: def __init__(
      self,
      h: int,
      input_size: int = -1,
      inference_input_size: int = -1,
      cell_type: str = "LSTM",
      dilations: List[List[int]] = [[1, 2], [4, 8]],
      encoder_hidden_size: int = 200,
      context_size: int = 10,
      decoder_hidden_size: int = 200,
      decoder_layers: int = 2,
      futr_exog_list=None,
      hist_exog_list=None,
      stat_exog_list=None,
      loss=MAE(),
      valid_loss=None,
      max_steps: int = 1000,
      learning_rate: float = 1e-3,
      num_lr_decays: int = 3,
      early_stop_patience_steps: int = -1,
      val_check_steps: int = 100,
      batch_size=32,
      valid_batch_size: Optional[int] = None,
      step_size: int = 1,
      scaler_type: str = "robust",
      random_seed: int = 1,
      num_workers_loader: int = 0,
      drop_last_loader: bool = False,
      **trainer_kwargs,
  ):
      super(DilatedRNN, self).__init__(
          h=h,
          input_size=input_size,
          inference_input_size=inference_input_size,
          loss=loss,
          valid_loss=valid_loss,
          max_steps=max_steps,
          learning_rate=learning_rate,
          num_lr_decays=num_lr_decays,
          early_stop_patience_steps=early_stop_patience_steps,
          val_check_steps=val_check_steps,
          batch_size=batch_size,
          valid_batch_size=valid_batch_size,
          scaler_type=scaler_type,
          futr_exog_list=futr_exog_list,
          hist_exog_list=hist_exog_list,
          stat_exog_list=stat_exog_list,
          num_workers_loader=num_workers_loader,
          drop_last_loader=drop_last_loader,
          random_seed=random_seed,
          **trainer_kwargs,
      )
  
      # Dilated RNN
      self.cell_type = cell_type
      self.dilations = dilations
      self.encoder_hidden_size = encoder_hidden_size
  
      # Context adapter
      self.context_size = context_size
  
      # MLP decoder
      self.decoder_hidden_size = decoder_hidden_size
      self.decoder_layers = decoder_layers
  
      self.futr_exog_size = len(self.futr_exog_list)
      self.hist_exog_size = len(self.hist_exog_list)
      self.stat_exog_size = len(self.stat_exog_list)
  
      # RNN input size (1 for target variable y)
      input_encoder = 1 + self.hist_exog_size + self.stat_exog_size
  
      # Instantiate model
      layers = []
      for grp_num in range(len(self.dilations)):
          if grp_num == 0:
              input_encoder = (
                  1 + self.hist_exog_size + self.stat_exog_size
              )
          else:
              input_encoder = self.encoder_hidden_size
          layer = DRNN(
              input_encoder,
              self.encoder_hidden_size,
              n_layers=len(self.dilations[grp_num]),
              dilations=self.dilations[grp_num],
              cell_type=self.cell_type,
          )
          layers.append(layer)
  
      self.rnn_stack = nn.Sequential(*layers)
  
      # Context adapter
      self.context_adapter = nn.Linear(
          in_features=self.encoder_hidden_size
          + self.futr_exog_size * h,
          out_features=self.context_size * h,
      )
  
      # Decoder MLP
      self.mlp_decoder = MLP(
          in_features=self.context_size + self.futr_exog_size,
          out_features=self.loss.outputsize_multiplier,
          hidden_size=self.decoder_hidden_size,
          num_layers=self.decoder_layers,
          activation="ReLU",
          dropout=0.0,
      )
  
imports: from typing import List, Optional
  import torch
  import torch.nn
  from ..losses.pytorch import MAE
  from ..common._base_recurrent import BaseRecurrent
  from ..common._modules import MLP
label_desc: Use image node_id 1 to create a new DilatedRNN object from inherited base classes: BaseRecurrent with example: obj = DilatedRNN(h, input_size, inference_input_size, cell_type, dilations, encoder_hidden_size, context_size, decoder_hidden_size, decoder_layers, futr_exog_list, hist_exog_list, stat_exog_list, loss, valid_loss, max_steps, learning_rate, num_lr_decays, early_stop_patience_steps, val_check_steps, batch_size, valid_batch_size, step_size, scaler_type, random_seed, num_workers_loader, drop_last_loader)