class_docstr: Module implementing the iTransformer model for multivariate forecasting as described in
  https://arxiv.org/abs/2310.06625 extended to be probabilistic.
  
  Parameters
  ----------
  prediction_length
      Number of time points to predict.
  context_length
      Number of time steps prior to prediction time that the model.
  d_model
      Transformer latent dimension.
  nhead
      Number of attention heads which must be divisible with d_model.
  dim_feedforward
      Dimension of the transformer's feedforward network model.
  dropout
      Dropout rate for the transformer.
  activation
      Activation function for the transformer.
  norm_first
      Whether to normalize the input before the transformer.
  num_encoder_layers
      Number of transformer encoder layers.
  scaling
      Whether to scale the input using mean or std or None.
  distr_output
      Distribution to use to evaluate observations and sample predictions.
      Default: ``StudentTOutput()``.
  nonnegative_pred_samples
      Should final prediction samples be non-negative? If yes, an activation
      function is applied to ensure non-negative. Observe that this is applied
      only to the final samples and this is not applied during training.
class_docstr_tok: ["Module","implementing","the","iTransformer","model","for","multivariate","forecasting","as","described","in","https",":","\/\/arxiv.org\/abs\/2310.06625","extended","to","be","probabilistic",".","Parameters","--","--","--","--","--","prediction_length","Number","of","time","points","to","predict",".","context_length","Number","of","time","steps","prior","to","prediction","time","that","the","model",".","d_model","Transformer","latent","dimension",".","nhead","Number","of","attention","heads","which","must","be","divisible","with","d_model",".","dim_feedforward","Dimension","of","the","transformer","'s","feedforward","network","model",".","dropout","Dropout","rate","for","the","transformer",".","activation","Activation","function","for","the","transformer",".","norm_first","Whether","to","normalize","the","input","before","the","transformer",".","num_encoder_layers","Number","of","transformer","encoder","layers",".","scaling","Whether","to","scale","the","input","using","mean","or","std","or","None",".","distr_output","Distribution","to","use","to","evaluate","observations","and","sample","predictions",".","Default",":","``","StudentTOutput","(",")","``",".","nonnegative_pred_samples","Should","final","prediction","samples","be","non-negative","?","If","yes",",","an","activation","function","is","applied","to","ensure","non-negative",".","Observe","that","this","is","applied","only","to","the","final","samples","and","this","is","not","applied","during","training","."]
code: def forward(
      self,
      past_target: torch.Tensor,
      past_observed_values: torch.Tensor,
  ) -> Tuple[Tuple[torch.Tensor, ...], torch.Tensor, torch.Tensor]:
      # scale the input
      past_target_scaled, loc, scale = self.scaler(
          past_target, past_observed_values
      )
      log_abs_loc = loc.abs().log1p()
      log_scale = scale.log()
  
      # Transpose to time last
      past_target_scaled = past_target_scaled.transpose(1, 2)
      log_abs_loc = log_abs_loc.transpose(1, 2)
      log_scale = log_scale.transpose(1, 2)
  
      # concatenate past target with log_abs_loc and log_scale
      expanded_target_scaled = torch.cat(
          [past_target_scaled, log_abs_loc, log_scale], dim=-1
      )
  
      # project to d_model
      enc_in = self.emebdding(expanded_target_scaled)
  
      # transformer encoder with positional encoding
      enc_out = self.encoder(enc_in)
  
      # project to prediction length * d_model // nhead
      projection_out = self.projection(enc_out).reshape(
          -1,
          past_target.shape[2],
          self.prediction_length,
          self.d_model // self.nhead,
      )
  
      # transpose to prediction length first
      projection_out_transpose = projection_out.transpose(1, 2)
  
      # project to distribution arguments
      distr_args = self.args_proj(projection_out_transpose)
      return distr_args, loc, scale
  
file_path: gluonts/src/gluonts/torch/model/i_transformer/module.py
imports: from typing import Optional, Tuple
  import torch
  from torch import nn
  from gluonts.core.component import validated
  from gluonts.model import Input, InputSpec
  from gluonts.torch.distributions import StudentTOutput
  from gluonts.torch.scaler import StdScaler, MeanScaler, NOPScaler
  from gluonts.torch.util import weighted_average
label_desc: Use image node_id 3 for calling the ITransformerModel obj's underlying member method code with example usage: obj.forward(past_target, past_observed_values) and returns: distr_args,  loc,  scale