code: def __init__(
      self,
      freq: str,
      prediction_length: int,
      context_length: Optional[int] = None,
      dropout_rate: float = 0.1,
      embed_dim: int = 32,
      num_heads: int = 4,
      num_outputs: int = 3,
      variable_dim: Optional[int] = None,
      time_features: List[TimeFeature] = [],
      static_cardinalities: Dict[str, int] = {},
      dynamic_cardinalities: Dict[str, int] = {},
      static_feature_dims: Dict[str, int] = {},
      dynamic_feature_dims: Dict[str, int] = {},
      past_dynamic_features: List[str] = [],
      trainer: Trainer = Trainer(),
  ) -> None:
      super().__init__(trainer=trainer)
  
      self.freq = freq
      self.prediction_length = prediction_length
      self.context_length = context_length or prediction_length
  
      # MultiheadAttention
      self.dropout_rate = dropout_rate
      self.embed_dim = embed_dim
      self.num_heads = num_heads
  
      self.num_outputs = num_outputs
      self.variable_dim = variable_dim or embed_dim
  
      if not time_features:
          self.time_features = time_features_from_frequency_str(
              self.freq
          )
      else:
          self.time_features = time_features
      self.static_cardinalities = static_cardinalities
      self.dynamic_cardinalities = dynamic_cardinalities
      self.static_feature_dims = static_feature_dims
      self.dynamic_feature_dims = dynamic_feature_dims
      self.past_dynamic_features = past_dynamic_features
  
      self.past_dynamic_cardinalities = {}
      self.past_dynamic_feature_dims = {}
      for name in self.past_dynamic_features:
          if name in self.dynamic_cardinalities:
              self.past_dynamic_cardinalities[
                  name
              ] = self.dynamic_cardinalities.pop(name)
          elif name in self.dynamic_feature_dims:
              self.past_dynamic_feature_dims[
                  name
              ] = self.dynamic_feature_dims.pop(name)
          else:
              raise ValueError(
                  f"Feature name {name} is not provided in feature dicts"
              )
  
      self.train_sampler = ExpectedNumInstanceSampler(
          num_instances=1.0, min_future=prediction_length
      )
  
      self.validation_sampler = ValidationSplitSampler(
          min_future=prediction_length
      )
  
imports: from itertools import chain
  from typing import List, Optional, Dict
  import numpy
  import torch
  from gluonts.core.component import validated
  from gluonts.dataset.field_names import FieldName
  from gluonts.model.forecast_generator import QuantileForecastGenerator
  from gluonts.model.predictor import Predictor
  from gluonts.time_feature import TimeFeature, time_features_from_frequency_str
  from gluonts.torch.model.predictor import PyTorchPredictor
  from gluonts.torch.util import copy_parameters
  from gluonts.transform import Transformation, Chain, ValidationSplitSampler, TestSplitSampler, ExpectedNumInstanceSampler, AddAgeFeature, AsNumpyArray, AddObservedValuesIndicator, AddTimeFeatures, VstackFeatures, SetField
  from pts import Trainer
  from pts.model import PyTorchEstimator
  from pts.model.utils import get_module_forward_input_names
  from .tft_network import TemporalFusionTransformerPredictionNetwork, TemporalFusionTransformerTrainingNetwork
  from .tft_transform import BroadcastTo, TFTInstanceSplitter
label_desc: Use image node_id 1 to create a new TemporalFusionTransformerEstimator object from inherited base classes: PyTorchEstimator with example: obj = TemporalFusionTransformerEstimator(freq, prediction_length, context_length, dropout_rate, embed_dim, num_heads, num_outputs, variable_dim, time_features, static_cardinalities, dynamic_cardinalities, static_feature_dims, dynamic_feature_dims, past_dynamic_features, trainer)