docstr: TiDE model forward pass.
  Parameters
  ----------
  x_in
      comes as tuple `(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)`
  Returns
  -------
  torch.Tensor
      The output Tensor of shape `(batch_size, output_chunk_length, output_dim, nr_params)`
docstr_tok: ["TiDE","model","forward","pass",".","Parameters","--","--","--","--","--","x_in","comes","as","tuple","`","(","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",")","`","Returns","--","--","--","-","torch.Tensor","The","output","Tensor","of","shape","`","(","batch_size",",","output_chunk_length",",","output_dim",",","nr_params",")","`"]
code: def forward(
      self,
      x_in: Tuple[
          torch.Tensor, Optional[torch.Tensor], Optional[torch.Tensor]
      ],
  ) -> torch.Tensor:
      """TiDE model forward pass.
      Parameters
      ----------
      x_in
          comes as tuple `(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)`
      Returns
      -------
      torch.Tensor
          The output Tensor of shape `(batch_size, output_chunk_length, output_dim, nr_params)`
      """
  
      # x has shape (batch_size, input_chunk_length, input_dim)
      # x_future_covariates has shape (batch_size, input_chunk_length, future_cov_dim)
      # x_static_covariates has shape (batch_size, static_cov_dim)
      x, x_future_covariates, x_static_covariates = x_in
  
      x_lookback = x[:, :, : self.output_dim]
  
      # future covariates: feature projection or raw features
      # historical future covariates need to be extracted from x and stacked with part of future covariates
      if self.future_cov_dim:
          x_dynamic_future_covariates = torch.cat(
              [
                  x[
                      :,
                      :,
                      None
                      if self.future_cov_dim == 0
                      else -self.future_cov_dim :,
                  ],
                  x_future_covariates,
              ],
              dim=1,
          )
          if self.temporal_width_future:
              # project input features across all input and output time steps
              x_dynamic_future_covariates = self.future_cov_projection(
                  x_dynamic_future_covariates
              )
      else:
          x_dynamic_future_covariates = None
  
      # past covariates: feature projection or raw features
      # the past covariates are embedded in `x`
      if self.past_cov_dim:
          x_dynamic_past_covariates = x[
              :,
              :,
              self.output_dim : self.output_dim + self.past_cov_dim,
          ]
          if self.temporal_width_past:
              # project input features across all input time steps
              x_dynamic_past_covariates = self.past_cov_projection(
                  x_dynamic_past_covariates
              )
      else:
          x_dynamic_past_covariates = None
  
      # setup input to encoder
      encoded = [
          x_lookback,
          x_dynamic_past_covariates,
          x_dynamic_future_covariates,
          x_static_covariates,
      ]
      encoded = [
          t.flatten(start_dim=1) for t in encoded if t is not None
      ]
      encoded = torch.cat(encoded, dim=1)
  
      # encoder, decode, reshape
      encoded = self.encoders(encoded)
      decoded = self.decoders(encoded)
  
      # get view that is batch size x output chunk length x self.decoder_output_dim x nr params
      decoded = decoded.view(x.shape[0], self.output_chunk_length, -1)
  
      # stack and temporally decode with future covariate last output steps
      temporal_decoder_input = [
          decoded,
          x_dynamic_future_covariates[:, -self.output_chunk_length :, :]
          if self.future_cov_dim > 0
          else None,
      ]
      temporal_decoder_input = [
          t for t in temporal_decoder_input if t is not None
      ]
  
      temporal_decoder_input = torch.cat(temporal_decoder_input, dim=2)
      temporal_decoded = self.temporal_decoder(temporal_decoder_input)
  
      # pass x_lookback through self.lookback_skip but swap the last two dimensions
      # this is needed because the skip connection is applied across the input time steps
      # and not across the output time steps
      skip = self.lookback_skip(x_lookback.transpose(1, 2)).transpose(
          1, 2
      )
  
      # add skip connection
      y = temporal_decoded + skip.reshape_as(
          temporal_decoded
      )  # skip.view(temporal_decoded.shape)
  
      y = y.view(
          -1, self.output_chunk_length, self.output_dim, self.nr_params
      )
      return y
  
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 2 for calling the _TideModule obj's underlying member method code with example usage: obj.forward(x_in) and returns: y