code: def assert_metrics_values(
      metrics: Dict[str, Any],
      desired_values: Dict[str, Any],
      rtol: float = 0.0001,
      atol: float = 1e-05,
  ):
      for key in metrics:
          if isinstance(metrics[key], Dict) and isinstance(
              desired_values[key], Dict
          ):
              for subkey in metrics[key]:
                  assert_allclose(
                      metrics[key][subkey],
                      desired_values[key][subkey],
                      rtol=rtol,
                      atol=atol,
                  )
          else:
              assert_allclose(
                  metrics[key],
                  desired_values[key],
                  rtol=rtol,
                  atol=atol,
              )
  
file_path: allennlp/allennlp/common/testing/__init__.py
imports: from typing import Dict, Any, Optional, Union, Tuple, List
  import torch
  from torch.testing import assert_allclose
  import pytest
  from allennlp.common.testing.test_case import AllenNlpTestCase
  from allennlp.common.testing.model_test_case import ModelTestCase
  from allennlp.common.testing.distributed_test import run_distributed_test
  from allennlp.modules.transformer import TransformerModule
  from allennlp.training.metrics import Metric
label_desc: Use image node_id 5 for calling a global function with example usage: assert_metrics_values(metrics, desired_values, rtol, atol) without return types