class_docstr: Wrapper around ``Forecast`` objects, that adds a batch dimension
  to arrays returned by ``__getitem__``, for compatibility with
  ``gluonts.ev``.
class_docstr_tok: ["Wrapper","around","``","Forecast","``","objects",",","that","adds","a","batch","dimension","to","arrays","returned","by","``","__getitem__","``",",","for","compatibility","with","``","gluonts.ev","``","."]
code: def __getitem__(self, name):
      values = [forecast[name].T for forecast in self.forecasts]
      res = np.stack(values, axis=0)
  
      if np.isnan(res).any():
          if not self.allow_nan:
              raise ValueError("Forecast contains NaN values")
  
          logger.warning(
              "Forecast contains NaN values. Metrics may be incorrect."
          )
  
      return res
  
imports: import logging
  from collections import ChainMap
  from typing import Iterable, List, Optional, Union
  from dataclasses import dataclass
  from toolz import first, valmap
  import numpy
  import pandas
  from tqdm import tqdm
  from gluonts.dataset import DataEntry
  from gluonts.dataset.split import TestData
  from gluonts.ev.ts_stats import seasonal_error
  from gluonts.itertools import batcher, prod
  from gluonts.model import Forecast, Predictor
  from gluonts.time_feature.seasonality import get_seasonality
label_desc: Use image node_id 1 for calling the BatchForecast obj's underlying member method code with example usage: obj.__getitem__(name) and returns: res