code: def __init__(
      self,
      input_size: int,
      num_layers: int,
      num_cells: int,
      cell_type: str,
      history_length: int,
      context_length: int,
      prediction_length: int,
      dropout_rate: float,
      lags_seq: List[int],
      target_dim: int,
      conditioning_length: int,
      flow_type: str,
      n_blocks: int,
      hidden_size: int,
      n_hidden: int,
      dequantize: bool,
      cardinality: List[int] = [1],
      embedding_dimension: int = 1,
      scaling: bool = True,
      **kwargs,
  ) -> None:
      super().__init__(**kwargs)
      self.target_dim = target_dim
      self.prediction_length = prediction_length
      self.context_length = context_length
      self.history_length = history_length
      self.scaling = scaling
  
      assert len(set(lags_seq)) == len(
          lags_seq
      ), "no duplicated lags allowed!"
      lags_seq.sort()
      self.lags_seq = lags_seq
  
      self.cell_type = cell_type
      rnn_cls = {"LSTM": nn.LSTM, "GRU": nn.GRU}[cell_type]
      self.rnn = rnn_cls(
          input_size=input_size,
          hidden_size=num_cells,
          num_layers=num_layers,
          dropout=dropout_rate,
          batch_first=True,
      )
  
      flow_cls = {
          "RealNVP": RealNVP,
          "MAF": MAF,
      }[flow_type]
      self.flow = flow_cls(
          input_size=target_dim,
          n_blocks=n_blocks,
          n_hidden=n_hidden,
          hidden_size=hidden_size,
          cond_label_size=conditioning_length,
      )
      self.dequantize = dequantize
  
      self.distr_output = FlowOutput(
          self.flow,
          input_size=target_dim,
          cond_size=conditioning_length,
      )
  
      self.proj_dist_args = self.distr_output.get_args_proj(num_cells)
  
      self.embed_dim = 1
      self.embed = nn.Embedding(
          num_embeddings=self.target_dim, embedding_dim=self.embed_dim
      )
  
      if self.scaling:
          self.scaler = MeanScaler(keepdim=True)
      else:
          self.scaler = NOPScaler(keepdim=True)
  
file_path: gluonts/src/gluonts/nursery/robust-mts-attack/pts/model/tempflow/tempflow_network.py
imports: from typing import List, Optional, Tuple, Union
  import torch
  import torch.nn
  from gluonts.core.component import validated
  from pts.model import weighted_average
  from pts.modules import RealNVP, MAF, FlowOutput, MeanScaler, NOPScaler
label_desc: Use image node_id 1 to create a new TempFlowTrainingNetwork object from inherited base classes: nn with example: obj = TempFlowTrainingNetwork(input_size, num_layers, num_cells, cell_type, history_length, context_length, prediction_length, dropout_rate, lags_seq, target_dim, conditioning_length, flow_type, n_blocks, hidden_size, n_hidden, dequantize, cardinality, embedding_dimension, scaling)