class_docstr: Data structure that manages the metric data (e.g., loss, accuracy, etc.).
  
  NOTE: Multiple metrics and minimized metrics are not supported in the current iteration.
  
  Parameters
  ----------
  strict
      Whether to convert the metrics into a float.
      If ``true``, only float metrics or dict with "default" are accepted.
code: def _canonicalize_metric(self, metric: Any) -> TrialMetric:
      if not self.strict:
          return cast(TrialMetric, metric)
      if isinstance(metric, dict):
          if "default" not in metric:
              raise ValueError(
                  f"Metric dict {metric} does not contain key 'default'"
              )
          metric = metric["default"]
      if not isinstance(metric, (int, float)):
          raise ValueError(f"Metric {metric} is not a number")
      return float(metric)
  
file_path: nni/nni/nas/space/metrics.py
imports: from __future__ import annotations
  from typing import Any, Sequence, cast
  from nni.typehint import TrialMetric
label_desc: Use image node_id 12 for calling the Metrics obj's underlying member method code with example usage: obj._canonicalize_metric(metric) and returns: float, cast