code: def register_metric(
      name: str,
      feature_types: Union[str, List[str]],
      objective: Literal[MINIMIZE, MAXIMIZE],
      output_feature_tensor_name: Literal[
          PREDICTIONS, PROBABILITIES, LOGITS
      ],
  ):
      """Registers a metric class.
  
      Args:
          name: The name of the metric. Used in metric reporting and in the config.
          feature_types: The feature types that this metric can be used with.
          objective: The objective of the metric. Either MINIMIZE or MAXIMIZE.
          output_feature_tensor_name: Name of the tensor from output_feature::predictions() that should be used as input.
              For example: PREDICTIONS would be used for accuracy metrics while LOGITS would be used for loss metrics.
      """
      if isinstance(feature_types, str):
          feature_types = [feature_types]
  
      def wrap(cls):
          for feature_type in feature_types:
              feature_registry = metric_feature_type_registry.get(
                  feature_type, {}
              )
              feature_registry[name] = cls
              metric_feature_type_registry[
                  feature_type
              ] = feature_registry
          metric_registry[name] = cls
          metric_objective_registry[name] = objective
          metric_tensor_input_registry[
              name
          ] = output_feature_tensor_name
          return cls
  
      return wrap
  
file_path: ludwig/ludwig/modules/metric_registry.py
imports: from typing import Dict, List, Literal, TYPE_CHECKING, Union
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import LOGITS, MAXIMIZE, MINIMIZE, PREDICTIONS, PROBABILITIES, RESPONSE
  from ludwig.utils.registry import Registry
label_desc: Use image node_id 1 for calling a global function with example usage: register_metric(name, feature_types, objective, output_feature_tensor_name) and returns: wrap, cls