code: def smape(y_pred: np.ndarray, y_true: np.ndarray) -> np.ndarray:
      median = y_pred
      num = np.abs(y_true - median)
      denom = (np.abs(y_true) + np.abs(median)) / 2
      # If the denominator is 0, we set it to float('inf') such that any division yields 0 (this
      # might not be fully mathematically correct, but at least we don't get NaNs)
      denom[denom == 0] = math.inf
      return np.mean(num / denom, axis=1).mean()
  
file_path: gluonts/src/gluonts/nursery/few_shot_prediction/src/meta/metrics/numpy.py
imports: import math
  import numpy
  import numpy.ma
  from typing import List, Dict
  from meta.datasets.splits import EvaluationDataset
label_desc: Use image node_id 7 for calling a global function with example usage: smape(y_pred, y_true) and returns: np