code: def get_data_batches(predictor, test_data):
      forecasts = predictor.predict(dataset=test_data.input)
      for input_, label, forecast in zip(
          test_data.input, test_data.label, forecasts
      ):
          forecast_batch = SampleForecastBatch(
              samples=np.array([forecast.samples]),
              start_date=[forecast.start_date],
              item_id=[forecast.item_id],
              info=[forecast.info],
          )
  
          seasonality = get_seasonality(
              freq=forecast.start_date.freqstr
          )
          freq = forecast.start_date.freqstr
          other_data = {
              "label": np.array([label["target"]]),
              "seasonal_error": np.array(
                  [
                      seasonal_error(
                          input_["target"], seasonality=seasonality
                      )
                  ]
              ),
              "naive_2": np.array(
                  [
                      naive_2(
                          input_["target"],
                          len(label["target"]),
                          season_length=seasonality,
                      )
                  ]
              ),
          }
  
          yield ChainMap(other_data, forecast_batch)
  
imports: from copy import deepcopy
  from typing import ChainMap, Iterator, Optional, Union
  from dataclasses import dataclass
  import numpy
  from gluonts.dataset.repository import get_dataset
  from gluonts.dataset.split import TestData, split
  from gluonts.ext.naive_2 import naive_2
  from gluonts.time_feature.seasonality import get_seasonality
  from gluonts.model.forecast import Quantile, SampleForecast
  from gluonts.model.seasonal_naive import SeasonalNaivePredictor
  from gluonts.evaluation import Evaluator
  from gluonts.evaluation.backtest import make_evaluation_predictions
  from gluonts.ev import evaluate
  from gluonts.ev.ts_stats import seasonal_error
  from gluonts.ev.metrics import MAPE, MASE, MSE, MSIS, SMAPE, Coverage, SumAbsoluteError, SumQuantileLoss, mean_absolute_label, sum_absolute_label, ND, NRMSE, RMSE, MAECoverage, MeanSumQuantileLoss, MeanWeightedSumQuantileLoss, WeightedSumQuantileLoss, OWA
label_desc: Use image node_id 1 for calling a global function with example usage: get_data_batches(predictor, test_data) without return types