code: def smape(
      y_pred: npt.NDArray[np.float32], y_true: npt.NDArray[np.float32]
  ) -> float:
      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/tsbench/src/tsbench/forecasts/metrics.py
imports: import math
  import numpy
  import numpy.typing
  from numpy import ma
  from .quantile import QuantileForecasts
label_desc: Use image node_id 7 for calling a global function with example usage: smape(y_pred, y_true) and returns: np