class_docstr: Module implementing the PatchTST model for forecasting as described in
  https://arxiv.org/abs/2211.14730 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.
  distr_output
      Distribution to use to evaluate observations and sample predictions.
      Default: ``StudentTOutput()``.
class_docstr_tok: ["Module","implementing","the","PatchTST","model","for","forecasting","as","described","in","https",":","\/\/arxiv.org\/abs\/2211.14730","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",".","distr_output","Distribution","to","use","to","evaluate","observations","and","sample","predictions",".","Default",":","``","StudentTOutput","(",")","``","."]
code: def __init__(
      self,
      prediction_length: int,
      context_length: int,
      patch_len: int,
      stride: int,
      padding_patch: str,
      d_model: int,
      nhead: int,
      dim_feedforward: int,
      dropout: float,
      activation: str,
      norm_first: bool,
      num_encoder_layers: int,
      scaling: str,
      distr_output=StudentTOutput(),
  ) -> None:
      super().__init__()
  
      assert prediction_length > 0
      assert context_length > 0
  
      self.prediction_length = prediction_length
      self.context_length = context_length
      self.patch_len = patch_len
      self.stride = stride
      self.d_model = d_model
      self.padding_patch = padding_patch
      self.distr_output = distr_output
  
      if scaling == "mean":
          self.scaler = MeanScaler(keepdim=True)
      elif scaling == "std":
          self.scaler = StdScaler(keepdim=True)
      else:
          self.scaler = NOPScaler(keepdim=True)
  
      self.patch_num = int((context_length - patch_len) / stride + 1)
      if padding_patch == "end":  # can be modified to general case
          self.padding_patch_layer = nn.ReplicationPad1d(
              (0, self.stride)
          )
          self.patch_num += 1
  
      # project from patch_len + 2 features (loc and scale) to d_model
      self.patch_proj = make_linear_layer(patch_len + 2, d_model)
  
      self.positional_encoding = SinusoidalPositionalEmbedding(
          self.patch_num, d_model
      )
  
      layer_norm_eps: float = 1e-5
      encoder_layer = nn.TransformerEncoderLayer(
          d_model=d_model,
          nhead=nhead,
          dim_feedforward=dim_feedforward,
          dropout=dropout,
          activation=activation,
          layer_norm_eps=layer_norm_eps,
          batch_first=True,
          norm_first=norm_first,
      )
      encoder_norm = nn.LayerNorm(d_model, eps=layer_norm_eps)
      self.encoder = nn.TransformerEncoder(
          encoder_layer, num_encoder_layers, encoder_norm
      )
  
      self.flatten = nn.Linear(
          d_model * self.patch_num, prediction_length * d_model
      )
  
      self.args_proj = self.distr_output.get_args_proj(d_model)
  
imports: from typing import Tuple
  import numpy
  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 unsqueeze_expand, weighted_average
  from gluonts.torch.model.simple_feedforward import make_linear_layer
label_desc: Use image node_id 1 to create a new PatchTSTModel object from inherited base classes: nn with example: obj = PatchTSTModel(prediction_length, context_length, patch_len, stride, padding_patch, d_model, nhead, dim_feedforward, dropout, activation, norm_first, num_encoder_layers, scaling, distr_output)