code: def assert_equal_parameters(
      old_module: torch.nn.Module,
      new_module: TransformerModule,
      ignore_missing: bool = False,
      mapping: Optional[Dict] = None,
  ):
      """
      Tests if the parameters present in the `new_module` are equal to the ones in `old_module`.
      Note that any parameters present in the `old_module` that are not present in `new_module`
      are ignored.
      """
      mapping = mapping or {}
  
      old_parameters = dict(old_module.named_parameters())
      present_only_in_old = set(old_parameters.keys())
  
      for name, parameter in new_module.named_parameters():
          for key, val in mapping.items():
              name = name.replace(key, val)
          if ignore_missing:
              if name not in old_parameters:
                  continue
          present_only_in_old.remove(name)
          assert torch.allclose(old_parameters[name], parameter)
      return present_only_in_old
  
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 7 for calling a global function with example usage: assert_equal_parameters(old_module, new_module, ignore_missing, mapping) and returns: present_only_in_old