code: def infer_metrics_df_shape(
      metrics: List[MetricDefinition],
      test_data: TestData,
      axis: Union[int, Tuple[int]],
  ) -> Tuple[int]:
      """
      Infer expected shape of metrics data frame.
      """
      labels = list(test_data.label)
      test_data_shape = (len(labels), *labels[0]["target"].shape)
  
      if axis is None:
          axis = tuple(range(len(test_data_shape)))
      if isinstance(axis, int):
          axis = (axis,)
  
      return (
          prod(
              test_data_shape[d]
              for d in range(len(test_data_shape))
              if d not in axis
          ),
          len(metrics),
      )
  
file_path: gluonts/test/model/test_evaluation.py
imports: from typing import List, Tuple, Union
  import numpy
  import pytest
  import pandas
  from gluonts.dataset.split import split, TestData
  from gluonts.itertools import prod
  from gluonts.model.seasonal_naive import SeasonalNaivePredictor
  from gluonts.model import SampleForecast, evaluate_forecasts, evaluate_model
  from gluonts.ev.metrics import MetricDefinition, MSE, RMSE, NRMSE, MAPE, SMAPE, MASE, MSIS, ND, WeightedSumQuantileLoss, MeanWeightedSumQuantileLoss, MeanScaledQuantileLoss, AverageMeanScaledQuantileLoss
label_desc: Use image node_id 1 for calling a global function with example usage: infer_metrics_df_shape(metrics, test_data, axis) and returns: prod,  len