class_docstr: Sequence-to-Sequence (seq2seq) structure with the so-called
  "Forking Sequence" proposed in [WTN+17]_.
  
  The basic idea is that, given a sequence :math:`x_1, x_2, \cdots, x_T`,
  with a decoding length :math:`\tau`, we learn a NN that solves the
  following series of seq2seq problems:
  
  .. math::
     :nowrap:
  
     \begin{eqnarray}
     x_1                     & \mapsto & x_{2:2+\tau}\\
     x_1, x_2                & \mapsto & x_{3:3+\tau}\\
     x_1, x_2, x_3           & \mapsto & x_{4:4+\tau}\\
                             & \ldots  & \\
     x_1, \ldots, x_{T-\tau} & \mapsto & x_{T-\tau+1:T}
     \end{eqnarray}
  
  Essentially, this means instead of having one cut in the standard seq2seq,
  one has multiple cuts that progress linearly.
  
  Parameters
  ----------
  encoder
      seq2seq encoder
  decoder
      seq2seq decoder
  quantile_output
      quantile output
  distr_output
      distribution output
  freq
      frequency of the time series.
  prediction_length
      length of the decoding sequence.
  context_length
      length of the encoding sequence. (default: 4 * prediction_length)
  use_past_feat_dynamic_real
      Whether to use the ``past_feat_dynamic_real`` field from the data.
      (default: False)
  use_feat_dynamic_real
      Whether to use the ``feat_dynamic_real`` field from the data.
      (default: False)
  use_feat_static_cat:
      Whether to use the ``feat_static_cat`` field from the data.
      (default: False)
  cardinality: List[int] = None,
      Number of values of each categorical feature.
      This must be set if ``use_feat_static_cat == True``. (default: None)
  embedding_dimension: List[int] = None,
      Dimension of the embeddings for categorical features.
      (default: [min(50, (cat+1)//2) for cat in cardinality])
  add_time_feature
      Adds a set of time features. (default: True)
  add_age_feature
      Adds an age feature. (default: False)
      The age feature starts with a small value at the start of the time
      series and grows over time.
  enable_encoder_dynamic_feature
      Whether the encoder should also be provided with the dynamic features
      (``age``, ``time`` and ``feat_dynamic_real`` if enabled respectively).
      (default: True)
  enable_decoder_dynamic_feature
      Whether the decoder should also be provided with the dynamic features
      (``age``, ``time`` and ``feat_dynamic_real`` if enabled respectively).
      (default: True)
      It makes sense to disable this, if you don't have ``feat_dynamic_real``
      for the prediction range.
  trainer
      trainer (default: Trainer())
  scaling
      Whether to automatically scale the target values. (default: False if
      quantile_output is used, True otherwise)
  scaling_decoder_dynamic_feature
      Whether to automatically scale the dynamic features for the decoder.
      (default: False)
  dtype
      (default: np.float32)
  num_forking
      Decides how much forking to do in the decoder. 1 reduces to seq2seq and
      enc_len reduces to MQ-C(R)NN.
  max_ts_len
      Returns the length of the longest time series in the dataset to be used
      in bounding context_length.
  train_sampler
      Controls the sampling of windows during training.
  validation_sampler
      Controls the sampling of windows during validation.
  batch_size
      The size of the batches to be used training and prediction.
class_docstr_tok: ["Sequence-to-Sequence","(","seq2seq",")","structure","with","the","so-called","''","Forking","Sequence","''","proposed","in","[","WTN+17","]","_",".","The","basic","idea","is","that",",","given","a","sequence",":","math",":","`","x_1",",","x_2",",","\\cdots",",","x_T","`",",","with","a","decoding","length",":","math",":","`","\\tau","`",",","we","learn","a","NN","that","solves","the","following","series","of","seq2seq","problems",":","..","math",":",":",":","nowrap",":","\\begin","{","eqnarray","}","x_1","&","\\mapsto","&","x_","{","2:2+\\tau","}","\\\\","x_1",",","x_2","&","\\mapsto","&","x_","{","3:3+\\tau","}","\\\\","x_1",",","x_2",",","x_3","&","\\mapsto","&","x_","{","4:4+\\tau","}","\\\\","&","\\ldots","&","\\\\","x_1",",","\\ldots",",","x_","{","T-\\tau","}","&","\\mapsto","&","x_","{","T-\\tau+1",":","T","}","\\end","{","eqnarray","}","Essentially",",","this","means","instead","of","having","one","cut","in","the","standard","seq2seq",",","one","has","multiple","cuts","that","progress","linearly",".","Parameters","--","--","--","--","--","encoder","seq2seq","encoder","decoder","seq2seq","decoder","quantile_output","quantile","output","distr_output","distribution","output","freq","frequency","of","the","time","series",".","prediction_length","length","of","the","decoding","sequence",".","context_length","length","of","the","encoding","sequence",".","(","default",":","4","*","prediction_length",")","use_past_feat_dynamic_real","Whether","to","use","the","``","past_feat_dynamic_real","``","field","from","the","data",".","(","default",":","False",")","use_feat_dynamic_real","Whether","to","use","the","``","feat_dynamic_real","``","field","from","the","data",".","(","default",":","False",")","use_feat_static_cat",":","Whether","to","use","the","``","feat_static_cat","``","field","from","the","data",".","(","default",":","False",")","cardinality",":","List","[","int","]","=","None",",","Number","of","values","of","each","categorical","feature",".","This","must","be","set","if","``","use_feat_static_cat","==","True","``",".","(","default",":","None",")","embedding_dimension",":","List","[","int","]","=","None",",","Dimension","of","the","embeddings","for","categorical","features",".","(","default",":","[","min","(","50",",","(","cat+1",")","\/\/2",")","for","cat","in","cardinality","]",")","add_time_feature","Adds","a","set","of","time","features",".","(","default",":","True",")","add_age_feature","Adds","an","age","feature",".","(","default",":","False",")","The","age","feature","starts","with","a","small","value","at","the","start","of","the","time","series","and","grows","over","time",".","enable_encoder_dynamic_feature","Whether","the","encoder","should","also","be","provided","with","the","dynamic","features","(","``","age","``",",","``","time","``","and","``","feat_dynamic_real","``","if","enabled","respectively",")",".","(","default",":","True",")","enable_decoder_dynamic_feature","Whether","the","decoder","should","also","be","provided","with","the","dynamic","features","(","``","age","``",",","``","time","``","and","``","feat_dynamic_real","``","if","enabled","respectively",")",".","(","default",":","True",")","It","makes","sense","to","disable","this",",","if","you","do","n't","have","``","feat_dynamic_real","``","for","the","prediction","range",".","trainer","trainer","(","default",":","Trainer","(",")",")","scaling","Whether","to","automatically","scale","the","target","values",".","(","default",":","False","if","quantile_output","is","used",",","True","otherwise",")","scaling_decoder_dynamic_feature","Whether","to","automatically","scale","the","dynamic","features","for","the","decoder",".","(","default",":","False",")","dtype","(","default",":","np.float32",")","num_forking","Decides","how","much","forking","to","do","in","the","decoder",".","1","reduces","to","seq2seq","and","enc_len","reduces","to","MQ-C","(","R",")","NN",".","max_ts_len","Returns","the","length","of","the","longest","time","series","in","the","dataset","to","be","used","in","bounding","context_length",".","train_sampler","Controls","the","sampling","of","windows","during","training",".","validation_sampler","Controls","the","sampling","of","windows","during","validation",".","batch_size","The","size","of","the","batches","to","be","used","training","and","prediction","."]
code: def create_predictor(
      self,
      transformation: Transformation,
      trained_network: ForkingSeq2SeqNetworkBase,
  ) -> Predictor:
      quantile_strs = (
          [
              Quantile.from_float(quantile).name
              for quantile in self.quantile_output.quantiles
          ]
          if self.quantile_output is not None
          else None
      )
  
      prediction_splitter = self._create_instance_splitter("test")
  
      prediction_network_class = (
          ForkingSeq2SeqPredictionNetwork
          if self.quantile_output is not None
          else ForkingSeq2SeqDistributionPredictionNetwork
      )
  
      prediction_network = prediction_network_class(
          encoder=trained_network.encoder,
          enc2dec=trained_network.enc2dec,
          decoder=trained_network.decoder,
          quantile_output=trained_network.quantile_output,
          distr_output=trained_network.distr_output,
          context_length=self.context_length,
          num_forking=self.num_forking,
          cardinality=self.cardinality,
          embedding_dimension=self.embedding_dimension,
          scaling=self.scaling,
          scaling_decoder_dynamic_feature=self.scaling_decoder_dynamic_feature,  # noqa: E501
          dtype=self.dtype,
      )
  
      copy_parameters(trained_network, prediction_network)
  
      return RepresentableBlockPredictor(
          input_transform=transformation + prediction_splitter,
          prediction_net=prediction_network,
          batch_size=self.batch_size,
          prediction_length=self.prediction_length,
          ctx=self.trainer.ctx,
          forecast_generator=(
              QuantileForecastGenerator(quantile_strs)
              if quantile_strs is not None
              else DistributionForecastGenerator(self.distr_output)
          ),
      )
  
imports: from functools import partial
  from typing import List, Optional, Type
  import numpy
  from gluonts.core.component import validated
  from gluonts.dataset.common import Dataset
  from gluonts.dataset.field_names import FieldName
  from gluonts.dataset.loader import DataLoader, TrainDataLoader, ValidationDataLoader
  from gluonts.model.forecast import Quantile
  from gluonts.model.forecast_generator import DistributionForecastGenerator, QuantileForecastGenerator
  from gluonts.model.predictor import Predictor
  from gluonts.mx.batchify import batchify
  from gluonts.mx.block.decoder import Seq2SeqDecoder
  from gluonts.mx.block.enc2dec import FutureFeatIntegratorEnc2Dec
  from gluonts.mx.block.encoder import Seq2SeqEncoder
  from gluonts.mx.block.quantile_output import QuantileOutput
  from gluonts.mx.distribution import DistributionOutput
  from gluonts.mx.model.estimator import GluonEstimator
  from gluonts.mx.model.predictor import RepresentableBlockPredictor
  from gluonts.mx.trainer import Trainer
  from gluonts.mx.util import copy_parameters, get_hybrid_forward_input_names
  from gluonts.time_feature import time_features_from_frequency_str
  from gluonts.transform import AddAgeFeature, AddConstFeature, AddObservedValuesIndicator, AddTimeFeatures, Chain, InstanceSampler, RemoveFields, RenameFields, SelectFields, SetField, TestSplitSampler, Transformation, ValidationSplitSampler, VstackFeatures
  from ._forking_network import ForkingSeq2SeqDistributionPredictionNetwork, ForkingSeq2SeqNetworkBase, ForkingSeq2SeqPredictionNetwork, ForkingSeq2SeqTrainingNetwork
  from ._transform import ForkingSequenceSplitter
label_desc: Use image node_id 7 for calling the ForkingSeq2SeqEstimator obj's underlying member method code with example usage: obj.create_predictor(transformation, trained_network) and returns: RepresentableBlockPredictor