code: def parse_metrics(
      metrics: Iterable[Union[str, dict]],
      in_y: List[str],
      out_vars: List[str],
  ) -> List[Metric]:
      metrics_functions = []
      for metric in metrics:
          if isinstance(metric, str):
              metric = {"name": metric, "alias": metric}
  
          metric_name = metric.pop("name")
          alias = metric.pop("alias", metric_name)
  
          f = get_metric_by_name(metric_name)
  
          inputs = metric.pop("inputs", in_y + out_vars)
          if isinstance(inputs, str):
              inputs = [inputs]
  
          metrics_functions.append(
              Metric(metric_name, partial(f, **metric), inputs, alias)
          )
  
      return metrics_functions
  
file_path: DeepPavlov/deeppavlov/core/trainers/utils.py
imports: from collections import OrderedDict, namedtuple
  from dataclasses import is_dataclass
  from functools import partial
  from json import JSONEncoder
  from typing import List, Tuple, Union, Iterable
  import numpy
  from deeppavlov.core.common.metrics_registry import get_metric_by_name
label_desc: Use image node_id 1 for calling a global function with example usage: parse_metrics(metrics, in_y, out_vars) and returns: metrics_functions