code: def test_metric_shape(
      metric: MetricDefinition, axis: Optional[tuple]
  ):
      input_length = 20
      label_length = 5
      num_entries = 7
  
      data = [
          {
              "input": np.random.normal(size=(1, input_length)),
              "label": np.random.normal(size=(1, label_length)),
              "0.1": np.random.normal(size=(1, label_length)),
              "0.5": np.random.normal(size=(1, label_length)),
              "0.9": np.random.normal(size=(1, label_length)),
              "mean": np.random.normal(size=(1, label_length)),
          }
          for _ in range(num_entries)
      ]
  
      for entry in data:
          entry["seasonal_error"] = seasonal_error(
              entry["input"], seasonality=1, time_axis=1
          )
  
      metric_value = metric(axis=axis).update_all(data).get()
  
      if axis is None or axis == (0, 1):
          assert isinstance(metric_value, float)
      elif axis == (0,):
          assert isinstance(metric_value, np.ndarray)
          assert metric_value.shape == (label_length,)
      elif axis == (1,):
          assert isinstance(metric_value, np.ndarray)
          assert metric_value.shape == (num_entries,)
      elif axis == ():
          assert isinstance(metric_value, np.ndarray)
          assert metric_value.shape == (num_entries, label_length)
      else:
          raise ValueError("unsupported axis")
  
      return metric_value
  
imports: from typing import Optional
  import numpy
  import pytest
  from gluonts.ev.metrics import Coverage, MAECoverage, MetricDefinition, MSE, MAE, MAPE, SMAPE, MASE, MeanScaledQuantileLoss, AverageMeanScaledQuantileLoss, WeightedSumQuantileLoss, MeanWeightedSumQuantileLoss, ND, RMSE, NRMSE
  from gluonts.ev.ts_stats import seasonal_error
label_desc: Use image node_id 1 for calling a global function with example usage: test_metric_shape(metric, axis) and returns: metric_value