code: def denumpify_detensorize(metrics):
      """
      Recursively calls `.item()` on the element of the dictionary passed
      """
      if isinstance(metrics, (list, tuple)):
          return type(metrics)(
              denumpify_detensorize(m) for m in metrics
          )
      elif isinstance(metrics, dict):
          return type(metrics)(
              {k: denumpify_detensorize(v) for k, v in metrics.items()}
          )
      elif isinstance(metrics, np.generic):
          return metrics.item()
      elif (
          is_torch_available()
          and isinstance(metrics, torch.Tensor)
          and metrics.numel() == 1
      ):
          return metrics.item()
      return metrics
  
imports: import copy
  import functools
  import gc
  import inspect
  import os
  import random
  import re
  import threading
  import time
  from typing import Any, Dict, List, NamedTuple, Optional, Tuple, Union
  import numpy
  from .utils import ExplicitEnum, is_psutil_available, is_tf_available, is_torch_available, is_torch_cuda_available, is_torch_tpu_available, requires_backends
label_desc: Use image node_id 14 for calling a global function with example usage: denumpify_detensorize(metrics) and returns: metrics, type, type, metrics, metrics