code: def _create_instance_splitter(self, mode: str):
      assert mode in ["training", "validation", "test"]
  
      instance_sampler = {
          "training": self.train_sampler,
          "validation": self.validation_sampler,
          "test": TestSplitSampler(),
      }[mode]
  
      time_series_fields = [FieldName.OBSERVED_VALUES]
      if self.use_feat_dynamic_cat:
          time_series_fields.append(FieldName.FEAT_DYNAMIC_CAT)
      if self.use_feat_dynamic_real or (self.time_features is not None):
          time_series_fields.append(FieldName.FEAT_DYNAMIC_REAL)
  
      return InstanceSplitter(
          target_field=FieldName.TARGET,
          is_pad_field=FieldName.IS_PAD,
          start_field=FieldName.START,
          forecast_start_field=FieldName.FORECAST_START,
          instance_sampler=instance_sampler,
          past_length=self.context_length,
          future_length=self.prediction_length,
          time_series_fields=time_series_fields,
      )
  
imports: from functools import partial
  from typing import List, Optional
  from mxnet.gluon import HybridBlock
  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_generator import QuantileForecastGenerator
  from gluonts.mx.batchify import batchify
  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 TimeFeature, time_features_from_frequency_str
  from gluonts.transform import AddAgeFeature, AddObservedValuesIndicator, AddTimeFeatures, AsNumpyArray, Chain, ExpectedNumInstanceSampler, InstanceSampler, InstanceSplitter, SelectFields, SetField, TestSplitSampler, Transformation, ValidationSplitSampler, VstackFeatures
  from ._network import SelfAttentionPredictionNetwork, SelfAttentionTrainingNetwork
label_desc: Use image node_id 3 for calling the SelfAttentionEstimator obj's underlying member method code with example usage: obj._create_instance_splitter(mode) and returns: InstanceSplitter