docstr: Pytorch module implementing the TiDE architecture.
  
  Parameters
  ----------
  input_dim
      The number of input components (target + optional past covariates + optional future covariates).
  output_dim
      Number of output components in the target.
  future_cov_dim
      Number of future covariates.
  static_cov_dim
      Number of static covariates.
  nr_params
      The number of parameters of the likelihood (or 1 if no likelihood is used).
  num_encoder_layers
      Number of stacked Residual Blocks in the encoder.
  num_decoder_layers
      Number of stacked Residual Blocks in the decoder.
  decoder_output_dim
      The number of output components of the decoder.
  hidden_size
      The width of the hidden layers in the encoder/decoder Residual Blocks.
  temporal_decoder_hidden
      The width of the hidden layers in the temporal decoder.
  temporal_width_past
      The width of the past covariate embedding space.
  temporal_width_future
      The width of the future covariate embedding space.
  use_layer_norm
      Whether to use layer normalization in the Residual Blocks.
  dropout
      Dropout probability
  **kwargs
      all parameters required for :class:`darts.model.forecasting_models.PLForecastingModule` base class.
  
  Inputs
  ------
  x
      Tuple of Tensors `(x_past, x_future, x_static)` where `x_past` is the input/past chunk and
      `x_future`is the output/future chunk. Input dimensions are `(batch_size, time_steps, components)`
  Outputs
  -------
  y
      Tensor of shape `(batch_size, output_chunk_length, output_dim, nr_params)`
docstr_tok: ["Pytorch","module","implementing","the","TiDE","architecture",".","Parameters","--","--","--","--","--","input_dim","The","number","of","input","components","(","target","+","optional","past","covariates","+","optional","future","covariates",")",".","output_dim","Number","of","output","components","in","the","target",".","future_cov_dim","Number","of","future","covariates",".","static_cov_dim","Number","of","static","covariates",".","nr_params","The","number","of","parameters","of","the","likelihood","(","or","1","if","no","likelihood","is","used",")",".","num_encoder_layers","Number","of","stacked","Residual","Blocks","in","the","encoder",".","num_decoder_layers","Number","of","stacked","Residual","Blocks","in","the","decoder",".","decoder_output_dim","The","number","of","output","components","of","the","decoder",".","hidden_size","The","width","of","the","hidden","layers","in","the","encoder\/decoder","Residual","Blocks",".","temporal_decoder_hidden","The","width","of","the","hidden","layers","in","the","temporal","decoder",".","temporal_width_past","The","width","of","the","past","covariate","embedding","space",".","temporal_width_future","The","width","of","the","future","covariate","embedding","space",".","use_layer_norm","Whether","to","use","layer","normalization","in","the","Residual","Blocks",".","dropout","Dropout","probability","*","*","kwargs","all","parameters","required","for",":","class",":","`","darts.model.forecasting_models.PLForecastingModule","`","base","class",".","Inputs","--","--","--","x","Tuple","of","Tensors","`","(","x_past",",","x_future",",","x_static",")","`","where","`","x_past","`","is","the","input\/past","chunk","and","`","x_future","`","is","the","output\/future","chunk",".","Input","dimensions","are","`","(","batch_size",",","time_steps",",","components",")","`","Outputs","--","--","--","-","y","Tensor","of","shape","`","(","batch_size",",","output_chunk_length",",","output_dim",",","nr_params",")","`"]
code: def __init__(
      self,
      input_dim: int,
      output_dim: int,
      future_cov_dim: int,
      static_cov_dim: int,
      nr_params: int,
      num_encoder_layers: int,
      num_decoder_layers: int,
      decoder_output_dim: int,
      hidden_size: int,
      temporal_decoder_hidden: int,
      temporal_width_past: int,
      temporal_width_future: int,
      use_layer_norm: bool,
      dropout: float,
      **kwargs,
  ):
      """Pytorch module implementing the TiDE architecture.
  
      Parameters
      ----------
      input_dim
          The number of input components (target + optional past covariates + optional future covariates).
      output_dim
          Number of output components in the target.
      future_cov_dim
          Number of future covariates.
      static_cov_dim
          Number of static covariates.
      nr_params
          The number of parameters of the likelihood (or 1 if no likelihood is used).
      num_encoder_layers
          Number of stacked Residual Blocks in the encoder.
      num_decoder_layers
          Number of stacked Residual Blocks in the decoder.
      decoder_output_dim
          The number of output components of the decoder.
      hidden_size
          The width of the hidden layers in the encoder/decoder Residual Blocks.
      temporal_decoder_hidden
          The width of the hidden layers in the temporal decoder.
      temporal_width_past
          The width of the past covariate embedding space.
      temporal_width_future
          The width of the future covariate embedding space.
      use_layer_norm
          Whether to use layer normalization in the Residual Blocks.
      dropout
          Dropout probability
      **kwargs
          all parameters required for :class:`darts.model.forecasting_models.PLForecastingModule` base class.
  
      Inputs
      ------
      x
          Tuple of Tensors `(x_past, x_future, x_static)` where `x_past` is the input/past chunk and
          `x_future`is the output/future chunk. Input dimensions are `(batch_size, time_steps, components)`
      Outputs
      -------
      y
          Tensor of shape `(batch_size, output_chunk_length, output_dim, nr_params)`
  
      """
  
      super().__init__(**kwargs)
  
      self.input_dim = input_dim
      self.output_dim = output_dim
      self.past_cov_dim = input_dim - output_dim - future_cov_dim
      self.future_cov_dim = future_cov_dim
      self.static_cov_dim = static_cov_dim
      self.nr_params = nr_params
      self.num_encoder_layers = num_encoder_layers
      self.num_decoder_layers = num_decoder_layers
      self.decoder_output_dim = decoder_output_dim
      self.hidden_size = hidden_size
      self.temporal_decoder_hidden = temporal_decoder_hidden
      self.use_layer_norm = use_layer_norm
      self.dropout = dropout
      self.temporal_width_past = temporal_width_past
      self.temporal_width_future = temporal_width_future
  
      # past covariates handling: either feature projection, raw features, or no features
      self.past_cov_projection = None
      if self.past_cov_dim and temporal_width_past:
          # residual block for past covariates feature projection
          self.past_cov_projection = _ResidualBlock(
              input_dim=self.past_cov_dim,
              output_dim=temporal_width_past,
              hidden_size=hidden_size,
              use_layer_norm=use_layer_norm,
              dropout=dropout,
          )
          past_covariates_flat_dim = (
              self.input_chunk_length * temporal_width_past
          )
      elif self.past_cov_dim:
          # skip projection and use raw features
          past_covariates_flat_dim = (
              self.input_chunk_length * self.past_cov_dim
          )
      else:
          past_covariates_flat_dim = 0
  
      # future covariates handling: either feature projection, raw features, or no features
      self.future_cov_projection = None
      if future_cov_dim and self.temporal_width_future:
          # residual block for future covariates feature projection
          self.future_cov_projection = _ResidualBlock(
              input_dim=future_cov_dim,
              output_dim=temporal_width_future,
              hidden_size=hidden_size,
              use_layer_norm=use_layer_norm,
              dropout=dropout,
          )
          historical_future_covariates_flat_dim = (
              self.input_chunk_length + self.output_chunk_length
          ) * temporal_width_future
      elif future_cov_dim:
          # skip projection and use raw features
          historical_future_covariates_flat_dim = (
              self.input_chunk_length + self.output_chunk_length
          ) * future_cov_dim
      else:
          historical_future_covariates_flat_dim = 0
  
      encoder_dim = (
          self.input_chunk_length * output_dim
          + past_covariates_flat_dim
          + historical_future_covariates_flat_dim
          + static_cov_dim
      )
  
      self.encoders = nn.Sequential(
          _ResidualBlock(
              input_dim=encoder_dim,
              output_dim=hidden_size,
              hidden_size=hidden_size,
              use_layer_norm=use_layer_norm,
              dropout=dropout,
          ),
          *[
              _ResidualBlock(
                  input_dim=hidden_size,
                  output_dim=hidden_size,
                  hidden_size=hidden_size,
                  use_layer_norm=use_layer_norm,
                  dropout=dropout,
              )
              for _ in range(num_encoder_layers - 1)
          ],
      )
  
      self.decoders = nn.Sequential(
          *[
              _ResidualBlock(
                  input_dim=hidden_size,
                  output_dim=hidden_size,
                  hidden_size=hidden_size,
                  use_layer_norm=use_layer_norm,
                  dropout=dropout,
              )
              for _ in range(num_decoder_layers - 1)
          ],
          # add decoder output layer
          _ResidualBlock(
              input_dim=hidden_size,
              output_dim=decoder_output_dim
              * self.output_chunk_length
              * self.nr_params,
              hidden_size=hidden_size,
              use_layer_norm=use_layer_norm,
              dropout=dropout,
          ),
      )
  
      decoder_input_dim = decoder_output_dim * self.nr_params
      if temporal_width_future and future_cov_dim:
          decoder_input_dim += temporal_width_future
      elif future_cov_dim:
          decoder_input_dim += future_cov_dim
  
      self.temporal_decoder = _ResidualBlock(
          input_dim=decoder_input_dim,
          output_dim=output_dim * self.nr_params,
          hidden_size=temporal_decoder_hidden,
          use_layer_norm=use_layer_norm,
          dropout=dropout,
      )
  
      self.lookback_skip = nn.Linear(
          self.input_chunk_length,
          self.output_chunk_length * self.nr_params,
      )
  
file_path: darts/darts/models/forecasting/tide_model.py
imports: from typing import Optional, Tuple
  import torch
  import torch.nn
  from darts.logging import get_logger, raise_log
  from darts.models.forecasting.pl_forecasting_module import PLMixedCovariatesModule, io_processor
  from darts.models.forecasting.torch_forecasting_model import MixedCovariatesTorchModel
label_desc: Use image node_id 1 to create a new _TideModule object from inherited base classes: PLMixedCovariatesModule with example: obj = _TideModule(input_dim, output_dim, future_cov_dim, static_cov_dim, nr_params, num_encoder_layers, num_decoder_layers, decoder_output_dim, hidden_size, temporal_decoder_hidden, temporal_width_past, temporal_width_future, use_layer_norm, dropout)